Suppose I have an Account model which has_many Users. Accounts have a boolean "active" column. How can I get all Users that belong to "active" accounts?
@users_of_active_accounts = User.?
Thanks!
You need to join the accounts table and merge appropriate Account scope:
User.joins(:account).merge(Account.where(:active => true))