Skip to content

Instantly share code, notes, and snippets.

@andyferra
Created September 9, 2010 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyferra/571318 to your computer and use it in GitHub Desktop.
Save andyferra/571318 to your computer and use it in GitHub Desktop.
validates_presence_of :salesrep, :days_discounted, :discount_percent, :days_until_due
validates_presence_of :name, :address, :number, :phone_number, :start_on
validates_uniqueness_of :name, :number
validates_numericality_of :days_discounted, :greater_than_or_equal_to => 0, :only_integer => true
validates_numericality_of :discount_percent, :greater_than_or_equal_to => 0
validates_numericality_of :days_until_due, :greater_than_or_equal_to => 0, :only_integer => true
named_scope :like, case_insensitive_query_on(:name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment