Module: Redde::Sluggable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/redde/sluggable.rb
Instance Method Summary collapse
Instance Method Details
#set_slug ⇒ Object
14 15 16 |
# File 'app/models/concerns/redde/sluggable.rb', line 14 def set_slug self.slug = Redde::UrlGenerator.new(self, title_field).formatted_name.downcase unless slug.present? end |
#title_field ⇒ Object
18 19 20 |
# File 'app/models/concerns/redde/sluggable.rb', line 18 def title_field send(title_symbol) end |
#title_symbol ⇒ Object
22 23 24 25 26 |
# File 'app/models/concerns/redde/sluggable.rb', line 22 def title_symbol self.class::TITLE_SYMBOL rescue :title end |
#to_param ⇒ Object
28 29 30 |
# File 'app/models/concerns/redde/sluggable.rb', line 28 def to_param "#{id}-#{slug.try(:downcase)}" end |