Class: FriendlyId::DataMapperAdapter::Configuration
- Inherits:
-
Configuration
- Object
- Configuration
- FriendlyId::DataMapperAdapter::Configuration
- Defined in:
- lib/friendly_id/datamapper_adapter/configuration.rb
Overview
Extends FriendlyId::Configuration with some implementation details and features specific to DataMapper.
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.
Instance Method Summary collapse
- #cache_column? ⇒ Boolean
- #custom_cache_column? ⇒ Boolean
- #scope_for(record) ⇒ Object
- #scopes_over?(klass) ⇒ Boolean
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.
13 14 15 |
# File 'lib/friendly_id/datamapper_adapter/configuration.rb', line 13 def cache_column @cache_column end |
#child_scopes ⇒ Object (readonly)
An array of classes for which the configured class serves as a FriendlyId scope.
17 18 19 |
# File 'lib/friendly_id/datamapper_adapter/configuration.rb', line 17 def child_scopes @child_scopes end |
#custom_cache_column ⇒ Object (readonly)
Returns the value of attribute custom_cache_column.
19 20 21 |
# File 'lib/friendly_id/datamapper_adapter/configuration.rb', line 19 def custom_cache_column @custom_cache_column end |
Instance Method Details
#cache_column? ⇒ Boolean
26 27 28 |
# File 'lib/friendly_id/datamapper_adapter/configuration.rb', line 26 def cache_column? !! cache_column end |
#custom_cache_column? ⇒ Boolean
41 42 43 |
# File 'lib/friendly_id/datamapper_adapter/configuration.rb', line 41 def custom_cache_column? !! custom_cache_column end |
#scope_for(record) ⇒ Object
45 46 47 |
# File 'lib/friendly_id/datamapper_adapter/configuration.rb', line 45 def scope_for(record) scope? ? record.send(scope).to_param : nil end |
#scopes_over?(klass) ⇒ Boolean
49 50 51 |
# File 'lib/friendly_id/datamapper_adapter/configuration.rb', line 49 def scopes_over?(klass) scope? && scope == klass.to_s.underscore.to_sym end |