Reputation: 2754
I am currently getting has_many relationship associations of a User model using this
User.reflect_on_all_associations(:has_many)
Now, how can I want to get User models with has_many through associations
Upvotes: 1
Views: 129
Reputation: 857
If you only want the has_many :through
associations, you can filter your array like this:
User.reflect_on_all_associations(:has_many).select do |association|
association.options.key? :through
end
Upvotes: 8