Blog

Monday, September 13, 2010

Rails Validations can be any ActiveRecord Model Instance Methods

class Customer

  # first_name: string
  # last_name: string

  validates_presence_of :first_or_last_name, :message => "must be provided"

  def first_or_last_name
    first_name || last_name
  end

end

Please note this blog is no longer maintained. Please visit CivilCode Inc - Custom Software Development.