Module: SluggableAnt::ClassMethods
- Defined in:
- lib/sluggable_ant.rb
Instance Method Summary collapse
Instance Method Details
#has_slug(field, **when_to_generate) ⇒ Object
ex. when_to_generate = { on: [:create, :update], if: … } use the same parameters that before_save callback accepts
13 14 15 16 |
# File 'lib/sluggable_ant.rb', line 13 def has_slug(field, **when_to_generate) self.slug_field = field before_save :generate_slug!, when_to_generate end |