Skip to content

Instantly share code, notes, and snippets.

@fdutey
Created January 22, 2009 23:27
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 fdutey/50787 to your computer and use it in GitHub Desktop.
Save fdutey/50787 to your computer and use it in GitHub Desktop.
class Bookmark < ActiveRecord::Base
#Validations
validates_presence_of :label
validates_presence_of :url
def clean_url
url =~ /^http:\/\//i ? url : "http://#{url}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment