Got NoMethodError on Model's find method.

Hi All,

I don’t know how this could happen. I got NoMethodError on running a simple Model’s find method. At first i have the same error for running find_all_by_country method where country is one of the model’s attributes. So, running a find method also doesn’t help. I have no problem running the methods on rails console. What should i check? Has anyone had a problem like this before?

My app running on a frozen rails 2.3.4 on OSX 10.6.2, ruby 1.8.7 patchlevel 174.

Thanks, Adinda P

I chat with someone. He told me to put this line before calling find method just to check in the development log:

logger.info self.class.methods.sort; return true

As far as I know it has nothing to do with the problem, but it works. Is there a setting that i don’t get correctly?

Thanks, Adinda

Hi all,

Here’s the pastie http://pastie.org/694864 that describe my situation. If you see the console section, flc is a Clan record. I can ran ‘find_all_by_country’ method. However, when i ran the ‘users_within_country’ method, i got NoMethodError on line 2.

Here are some updates. I was suggested to use searchlogic gem and i got similar error

NoMethodError: undefined method country_equals for Clan

I tried this on other ruby versions like: 1.8.7p72 (comes from Snow Leopard DVD), 1.8.6p114 on OpenSuSE and i still have the same error. I’m using frozen Rails 2.3.4. I don’t know what to do now? What should i check? Any suggestion?

Thanks, Dida

Hi all,

Here's the pastiehttp://pastie.org/694864that describe my situation. If you see the console section, flc is a Clan record. I can ran 'find_all_by_country' method. However, when i ran the 'users_within_country' method, i got NoMethodError on line 2.

Looking at your snippet, it looks like users_within_country is a class method - if so you can't call it on instances.

Fred