Skip to content

Instantly share code, notes, and snippets.

@pragdave
Created February 19, 2010 17:30
Show Gist options
  • Save pragdave/308949 to your computer and use it in GitHub Desktop.
Save pragdave/308949 to your computer and use it in GitHub Desktop.
validates_presence_of :title, :description, :image_url
validates_numericality_of :price, :greater_than => 0
validates_uniqueness_of :title
validates_format_of :image_url,
:with => %r{\.(gif|jpg|png)$}i,
:message => 'must be a URL for GIF, JPG or PNG image.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment