ruby on rails - Customizing ActsAsGeocodables Error Messages -
i have following code in model on rails 3 app. problem these error messages aren't appearing in form. know error messages partial correct because other errors other fields showing up. doing wrong?
validates_as_geocodable :allow_nil => true |geocode| if geocode.nil? model_instance.errors.add_to_base("please specify location") return false end if geocode.precision >= :locality model_instance.errors.add_to_base("try more specific w/ location") return false end end
if @ https://github.com/collectiveidea/acts_as_geocodable/blob/rails3/lib/acts_as_geocodable.rb see
if !geocode || (options[:precision] && geocode.precision < options[:precision]) || (block_given? && yield(geocode) == false) model.errors.add :base, options[:message] end and if geocode.nil? yield(geocode) never invoked => block not invoked too. don't know second condition, think should check too.
Comments
Post a Comment