has_many through association

@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