Skip to content

Instantly share code, notes, and snippets.

@laser
Created April 29, 2014 22:01
Show Gist options
  • Save laser/974c1c13febf53f2d653 to your computer and use it in GitHub Desktop.
Save laser/974c1c13febf53f2d653 to your computer and use it in GitHub Desktop.
The Contact Model
class Contact < ActiveRecord::Base
validates :full_name, presence: true
validates :alias, presence: true
validates :importance_level, inclusion: {
in: [100, 200, 300]
}
validates :age, numericality: {
greater_than: 0, only_integer: true
}
attr_readonly :alias, :full_name
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment