Forum: Ruby on Rails occassional NoMethodError after creating new model object

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Amir J. (Guest)
on 2009-03-05 19:50
(Received via mailing list)
This seems to happen every so often, where I have code similar to the

new_model_obj =
new_model_obj.someParam = someVar

And I get the following error:

<NoMethodError> undefined method `someParam=' for #<Foo >

This code normally runs fine with no problems, the Foo object clearly
has that attribute and this code works 95% of the time. The strange
thing I noticed is that in the error msg, #<Foo > does not have a hex
address location like it normally would. If I intentionally try to
create this error by calling new_model_obj.blah where I know blah is
not an attribute, I get an error msg that looks like this:

<NoMethodError> undefined method `blah' for #<Foo:0x476321c>

Anybody have any ideas why this would occasionally happen? Any help
would be greatly appreciated as I am thoroughly stumped.

This topic is locked and can not be replied to.