I have 3 tables - users, things, and follows. Users can follow things through the follows table, associating a user_id
with a things_id
. This would
For people using rails 4, the usage of :order, :select, etc has been deprecated. Now you need to specify as follows:
has_many :users, -> { select 'users.*, follows.is_admin as is_follow_admin' }, :through => :follows
To do this you need to use a bit of SQL in the has_many. Something like this should hopefully work.
has_many :users, :through => :follows, :select => 'users.*, follows.is_admin as is_follow_admin'
Then in the loop you should have access to
user.is_follow_admin
You might be able to do something like:
<% things.follows.each do |follow| %>
<%= follow.relation %>
<%= follow.user %>
<% end %>