Skip to content

Instantly share code, notes, and snippets.

@mudgen
Created February 22, 2010 01:03
Show Gist options
  • Save mudgen/310665 to your computer and use it in GitHub Desktop.
Save mudgen/310665 to your computer and use it in GitHub Desktop.
class Story < ActiveRecord::Base
validates_presence_of :name, :link
has_many :votes
def to_param
"#{id}-#{name.gsub(/\W/, '-').downcase}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment