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
Constant Summary
Constants inherited from Configuration
Instance Attribute Summary (collapse)
-
- (Object) cache_column
The column used to cache the friendly_id string.
-
- (Object) child_scopes
readonly
An array of classes for which the configured class serves as a FriendlyId scope.
-
- (Object) custom_cache_column
readonly
Returns the value of attribute custom_cache_column.
Attributes inherited from Configuration
#allow_nil, #approximate_ascii, #ascii_approximation_options, #configured_class, #max_length, #method, #reserved_message, #reserved_words, #scope, #sequence_separator, #strip_non_ascii, #use_slug
Instance Method Summary (collapse)
- - (Boolean) cache_column?
- - (Boolean) custom_cache_column?
- - (Object) scope_for(record)
- - (Boolean) scopes_over?(klass)
Methods inherited from Configuration
#babosa_options, #initialize, #reserved?, #reserved_error_message, scopes_used=, scopes_used?
Constructor Details
This class inherits a constructor from FriendlyId::Configuration
Instance Attribute Details
- (Object) cache_column
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 |
- (Object) child_scopes (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 |
- (Object) custom_cache_column (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
- (Boolean) cache_column?
27 28 29 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 27 def cache_column? !! cache_column end |
- (Boolean) custom_cache_column?
42 43 44 |
# File 'lib/friendly_id/active_record_adapter/configuration.rb', line 42 def custom_cache_column? !! custom_cache_column end |
- (Object) scope_for(record)
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 |
- (Boolean) scopes_over?(klass)
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 |