I have the following model in rails application
category => company => store
Store has a belongs_to
company and company has a belongs_to
category relationship.
now i want to use a where method on a store object to retrieve all stores within the same category.
I would like to have something like this
@stores.nearbys(5).where("stores.company.category_id = xxx")
can somebody give me a tip on this
where
supports nested hash.
@stores.nearbys(5).where(:company => { :category_id => @category.id }, joins: company)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With