hzamani / active_record-acts_as

Simulate multi-table inheritance for activerecord models
MIT License
252 stars 86 forks source link

Is there a way I can filter Parent objects with children attribute? #83

Closed marat-y closed 7 years ago

marat-y commented 7 years ago

Hello there!

Would you please let me know if there's a way of filtering Parent objects depending on children attribute?

For example,

Request.where(number: 2)

while number attribute is in product_requests table.

manuelmeurer commented 7 years ago

This is the most straightforward way I can think of: Request.where(actable: ProductRequest.where(number: 2))

manuelmeurer commented 7 years ago

You can now use ProductRequest.where(number: 2).actables (since v2.1.0).