Rails NoMethod Error calling dynamic find attribute

I am currently working on an application. In this application, I created the Person model, and I used the dynamic attribute search function. In the Person model, I have a uid attribute, so I called Person.find_by_uid (some numerical value). This worked fine in my development mode and the application was fully functional. However, as soon as I deployed this application to the hero. The application failed, and the log complains about NoMethodError (undefined method is `find_by_uid 'for #):

I looked at all the places, but still could not track the problem. I tried to define the find_by_uid method within the framework of the Person model and still does not work.

I was wondering if anyone has similar experience or does he know how to solve this problem?

Thank you very much for your time!

+3
source share
2 answers

Have you tried running migrations to heroku (heroku rake db: migrate)? In most cases, this attribute is not contained in the heroku database, so you do not have this dynamic method.

+3
source

I ran into the same problem. heroku restartsaved me.

0
source

Source: https://habr.com/ru/post/1791674/


All Articles