>
> @group.group_users.group_admin =1 (X- NOT WORKING THOUGH)
@group.group_users is not a single entity with the group_admin
attribute, it's a collection of group_users records...
@group.group_users.each do |group_user|
group_user.group_admin = 1
end
would set that attribute for every group_user record, but I don't think
that is you want to do.
I'd think you want to assign the group_admin for a single group_users
record for the group, which you'll need to select according to the
user_id.
A particularly ugly, but very clear implementation, might be:
@group.group_users.each do |group_user|
if group_user.user_id == the_user_id_of_your_admin
group_user.group_admin = 1
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---