Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails NoMethod Error when calling a dynamic attribute find

I am currently working on an app. In this app, I created a Person model and I was using rail's dynamic attribute find feature. In the Person model I have an attribute called uid, so I was calling Person.find_by_uid(some numerical value). This worked fine in my development mode and the app was totally functioning. However, once I deployed this app to heroku. The app failed and the log complains about NoMethodError (undefined method `find_by_uid' for #):

I have been looking all places, but still unable to track down the problem. I tried to define the method find_by_uid under the Person model, and still does not work.

I was wondering if anyone has had similar experience or knows how to solve this issue?

Thank you very much ahead of the time!

like image 786
Jacky Avatar asked Dec 08 '25 12:12

Jacky


1 Answers

Did you try running the migrations in heroku (heroku rake db:migrate)? Most provably that attribute is not in the heroku data base so you don't have that dynamic method.

like image 51
Fernando Diaz Garrido Avatar answered Dec 11 '25 01:12

Fernando Diaz Garrido



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!