Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/required/active_record.rb

Class Method Summary collapse

Class Method Details

.uses_slug(attrib = :name) ⇒ Object



2
3
4
5
6
# File 'lib/required/active_record.rb', line 2

def self.uses_slug(attrib = :name)
  define_method(:to_param) do
    "#{self.id}-#{self.send(attrib).parameterize}"
  end
end