Intern ruby wrote:
> 1))))) class Group < ActiveRecord::Base
> 
> has_many :group_users
>   has_many :users, :through => :group_users
> end
> 
> 2)))))))))class User < ActiveRecord::Base
> has_many :group_users
>   has_many :groups, :through => :group_users
> end
> 
> 3))))))class CreateGroupUsers < ActiveRecord::Migration   # JOINING
> TABLE
>   def self.up
>     create_table :group_users do |t|
>     t.column    :group_id,    :string
>     t.column    :user_id,    :string
>   t.column  :group_admin, :boolean
>       t.timestamps
>     end
>   end
> 
> 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:
 > test = Group.find(1)
 > test.group_users
 > test.group_users[0]
 > test.group_users[0].group_admin=1
-- 
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to