On 18 Feb 2009, at 13:40, Tarscher wrote:
>
> Why Can't I do:
> user = User.find(1)
> user.games.build(params[:game])
>
> I need to add to
> class Game < Event
> :belongs_to :user
> end
> and
> class User
> :has_many :events
> :has_many :users

I assume you meant to write has_many :games :-)

You can't do user.games.build without this since there is no games  
association, only an events association. You shouldn't need the extra  
belongs_to :user (which as you say should just be inherited from Event)

Fred
>
> end
>
> then
> user = User.find(1)
> user.games.build(params[:game])
> will work.
>
> Since Event already belongs_to user shoiuld game than also since it
> inherites?
>



> Regards,
> Stijn
>
>
>
>
>
>
>
>
>
>
> >


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