undefined method on web and not in irb

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.

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.

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.

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.

Random guess: does this still occur in production mode ?

Fred

Frederick Cheung wrote:

Frederick Cheung wrote:
>> run it through the browser.

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

> Random guess: does this still occur in production mode ?

> Fred

unfortunately is does

Is Foo defined in multiple places (some editors leave behind backup
copies of files that Rails loads anyway) ? If you stick a breakpoint
in does the Foo object you have look normal apart from raising an
error when bars is called ?

Fred

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

Colin Law wrote:

Frederick Cheung wrote: