has_many through association

Intern ruby wrote:

1))))) class Group < ActiveRecord::Base

has_many :group_users
  has_many :users, :through => :group_users

2)))))))))class User < ActiveRecord::Base
has_many :group_users
  has_many :groups, :through => :group_users

3))))))class CreateGroupUsers < ActiveRecord::Migration # JOINING
  def self.up
    create_table :group_users do |t|
    t.column :group_id, :string
    t.column :user_id, :string
  t.column :group_admin, :boolean

Can anybody please help me how to set the value of group_admin in
GroupUsers ?

I want to do like this :

@group.group_users.group_admin =1 (X- NOT WORKING THOUGH)

@group.group_users contains an array of users.. so you need to specify what user to set group_admin=1

try to open script/console and do: