In user model I’ve got attribute location of type point. Now I’ve got a validation code:
validates :location, :format => { :with => /\(-?\d+(?:\.\d+)?,-?\d(?:\.\d+)?\)/,
:on => :update,
:if => :location_changed? }
It works fine in console, on localhost, but on heroku it returns:
Processing by UsersController#update as / 2012-07-31T18:14:37+00:00
app[web.1]: Parameters:
{“user”=>{“location”=>”(3.545452,2.4353534)”}, “id”=>”self”}
2012-07-31T18:14:37+00:00 app[web.1]: 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 #<User:0x00000004dc29c8>):update’
2012-07-31T18:14:37+00:00 app[web.1]:
app/controllers/users_controller.rb:16:in
Actually it works also great in heroku console, but don’t work in curl request.
Rails version 3.2.7.
attr_accessible :profile_picture, :password, :location
Thanks!
It looks like a magic. I fixed it with recreation if table and server restart. Very strange.