Skip to content

Instantly share code, notes, and snippets.

@pragdave
Created February 19, 2010 17:32
Show Gist options
  • Save pragdave/308953 to your computer and use it in GitHub Desktop.
Save pragdave/308953 to your computer and use it in GitHub Desktop.
validates :title, :description, :image_url, :presence => true
validates :price, :numericality => { :greater_than => 0 }
validates :title, :uniqueness => true
validates :image_url,
:format => { :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