Rails 3.0 method_missing: undefined method in validator

Posted by user567592 on Stack Overflow See other posts from Stack Overflow or by user567592
Published on 2011-01-13T15:49:48Z Indexed on 2011/01/13 15:53 UTC
Read the original article Hit count: 154

Filed under:

== Schema Information

Schema version: 20110111000403

#

Table name: places

#

id :integer not null, primary key

name :string(255)

latitude :float

longitude :float

a place can be defined by latitude and longitude or by name

#

class Place < ActiveRecord::Base

validates_precence_of :name, :if => lat_long_not_def?

def lat_long_not_def? latitude.blank? || longitude.blank? end

end

© Stack Overflow or respective owner

Related posts about ruby-on-rails3