[Rails 3.2.1, Ruby 1.9.3]
in a Project model
I am trying to modify the :location attribute validation ( specific
LocationValidator using Geocoder…)
I need now to set it on create only
so I wrote :
validates :location, :location => { :on => :create }
but when I update the project instance, I get an error :
project.update_attributes(specific_payment:
partner[:specific_payment])
=> false
project.errors
=> #<ActiveModel::Errors:…
@messages={:location=>["?"]
if I add the location attribute in the update , then it works …
location = project.geocode[:address]
project.update_attributes(specific_payment:
partner[:specific_payment], location: location)
=> true
so, { :on => :create } seems not to be working … what could be
wrong ?
thanks for your feedback