Class: FriendlyId::ActiveRecordAdapter::Configuration
- Inherits:
-
Configuration
- Object
- Configuration
- FriendlyId::ActiveRecordAdapter::Configuration
- Defined in:
- lib/friendly_id/active_record_adapter/configuration.rb
Overview
Extends FriendlyId::Configuration with some implementation details and features specific to ActiveRecord.
Constant Summary
Constants inherited from Configuration
Instance Attribute Summary collapse
-
#cache_column ⇒ Object
The column used to cache the friendly_id string.
-
#child_scopes ⇒ Object
readonly
An array of classes for which the configured class serves as a FriendlyId scope.
-
#custom_cache_column ⇒ Object
readonly
Returns the value of attribute custom_cache_column.
Attributes inherited from Configuration
#allow_nil, #approximate_ascii, #ascii_approximation_options, #configured_class, #default_locale, #locale, #max_length, #method, #reserved_message, #reserved_words, #scope, #sequence_separator, #strip_non_ascii, #use_slug
Instance Method Summary collapse
- #cache_column? ⇒ Boolean
- #custom_cache_column? ⇒ Boolean
- #scope_for(record) ⇒ Object
- #scopes_over?(klass) ⇒ Boolean
Methods inherited from Configuration
#babosa_options, #initialize, locales_used?, #reserved?, #reserved_error_message, scopes_used=, scopes_used?
Constructor Details
This class inherits a constructor from FriendlyId::Configuration
Instance Attribute Details
#cache_column ⇒ Object
The column used to cache the friendly_id string. If no column is specified, FriendlyId will look for a column named cached_slug
and use it automatically if it exists. If for some reason you have a column named cached_slug
but don’t want FriendlyId to modify it, pass the option :cache_column => false to has_friendly_id.
14 15 16 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 14 def cache_column @cache_column end |
#child_scopes ⇒ Object (readonly)
An array of classes for which the configured class serves as a FriendlyId scope.
18 19 20 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 18 def child_scopes @child_scopes end |
#custom_cache_column ⇒ Object (readonly)
Returns the value of attribute custom_cache_column.
20 21 22 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 20 def custom_cache_column @custom_cache_column end |
Instance Method Details
#cache_column? ⇒ Boolean
27 28 29 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 27 def cache_column? !! cache_column end |
#custom_cache_column? ⇒ Boolean
42 43 44 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 42 def custom_cache_column? !! custom_cache_column end |
#scope_for(record) ⇒ Object
46 47 48 49 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 46 def scope_for(record) return nil unless scope? record.send(scope).nil? ? nil : record.send(scope).to_param end |
#scopes_over?(klass) ⇒ Boolean
51 52 53 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 51 def scopes_over?(klass) scope? && scope == klass.to_s.underscore.to_sym end |