Module: FriendlyId::Reserved::Configuration
- Defined in:
- lib/friendly_id/reserved.rb
Overview
This module adds the :reserved_words
configuration option to FriendlyId::Configuration.
Instance Attribute Summary collapse
-
#reserved_words ⇒ Object
An array of words forbidden as slugs.
Instance Method Summary collapse
-
#base=(base) ⇒ Object
Overrides Configuration#base to add a validation to the model class.
Instance Attribute Details
#reserved_words ⇒ Object
An array of words forbidden as slugs.
63 64 65 |
# File 'lib/friendly_id/reserved.rb', line 63 def reserved_words @reserved_words ||= @defaults[:reserved_words] end |
Instance Method Details
#base=(base) ⇒ Object
Overrides Configuration#base to add a validation to the model class.
56 57 58 59 60 |
# File 'lib/friendly_id/reserved.rb', line 56 def base=(base) super reserved_words = model_class.friendly_id_config.reserved_words model_class.validates_exclusion_of :friendly_id, :in => reserved_words end |