On 22 September 2010 21:33, Al Rowan <[email protected]> wrote:
> Hi all,
>
> still new at this lol, trying to create a one to many relationship
>
> i have:
>
> group.rb [
>
> belongs_to :user
> ]
>
> user.rb [
>
> has_many :groups
>
> ]

Could you show us the code for the models (leave out any methods you
have added, just the class definition and bits you put at the
beginning of the class.

>
> but if i do "user.groups" it just throws up:
> "NoMethodError: undefined method 'groups'.."

Do the users and groups tables exist in the database?  If so what
fields do they contain?

Show us the code around the failure and the stack trace please.

Colin

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