I have a many-to-many association implementing using association join
models:
class Source
has_many :source_users
has_many :users, :through => :source_users
end
class SourceUser
belongs_to :source
belongs_to :user
end
class User
has_many :source_users
has_many :users, :through => :source_users
The source_users table also contains a field called source_admin,
which marks the current user as an admin for this source. When I
create a new user with:
some_source.users << new_user
, how do I insert "true" or "false" in the source_admin field of the
SourceUser record that gets created?
Maybe there's a way to do it in less lines. But for me at least, if
it's clear and it works, why worry? I used to get wrapped around the
axle over that until I realized that sometimes taking a few lines to
do something so it's easy to read and follow is better than doing it
all in one line.