N
N
No_Time2012-07-31 23:12:01
Ruby on Rails
No_Time, 2012-07-31 23:12:01

How can you explain NoMethodError during validation of model fields only(!!!) on heroku?

There is a User model, it has a location: point field. There is a simple validation of this field:

validates :location, :format => { :with => /\(-?\d+(?:\.\d+)?,-?\d(?:\.\d+)?\)/,<br>
                                    :on => :update,<br>
                                    :if => :location_changed? }<br>

Those are nothing tricky, the built-in ActiveModel::Dirty rails component is used. It works fine on localhost, it's just fine in the console, it even works awesome in the Heroku console. But when I try to send a curl request to Herok, the following happens:
Completed 500 Internal Server Error in 13ms 2012-07-31T18:14:37+00:00 app[web.1]: 2012-07-31T18:14:37+00:00 app[web.1]: NoMethodError (undefined method location_changed?' for #&lt;User:0x00000004dc29c8&gt;)

I repeat, requests to the localhost go with a bang, and everything works wonderfully! What could be the reason? Ruby version 1.9.3; rails 3.2.7

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sl_bug, 2012-07-31
@No_Time

Let's start with a dumb question. Did you do a heroku restart?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question