On 7 March 2010 19:42, Michael Rigart <[email protected]> wrote:
> Hi all
>
> I seem to have a small problem in Rails. Lets say I have a class Foo
> with an habtm association to Bar. So Foo has_and_belongs_to Bars en vice
> versa.
>
> Now, when I do lets say
>
> Foo.new
> Foo.bars, I get an undefined method bars for #<Foo:0x1034f2f00> when I
> run it through the browser.

Foo.bars is not valid as Foo is a class not an instance, or is that
just a typo here? It should be something like
foo = Foo.new
then use foo.bars

Colin

>
> Now, when I do it through irb, it returns an empty array as expected.
> Does someone here has any clue how this can happen and what I need to
> look for, becouse I'm completely clueless.
>
> Thanks for any tips.
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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.
>
>

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