Class: FriendlyId::ActiveRecordAdapter::Finders::FinderProxy
- Inherits:
-
Object
- Object
- FriendlyId::ActiveRecordAdapter::Finders::FinderProxy
- Extended by:
- Forwardable
- Defined in:
- lib/friendly_id/active_record_adapter/finders.rb
Overview
FinderProxy is used to choose which finder class to instantiate; depending on the model_class’s friendly_id_config
and the options passed into the constructor, it will decide whether to use simple or slugged finder, a single or multiple finder, and in the case of slugs, a cached or uncached finder.
Instance Attribute Summary collapse
-
#finder ⇒ Object
readonly
Perform the find query.
-
#finder_class ⇒ Object
readonly
Returns the value of attribute finder_class.
-
#ids ⇒ Object
readonly
Returns the value of attribute ids.
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(model_class, *args, &block) ⇒ FinderProxy
constructor
A new instance of FinderProxy.
- #multiple? ⇒ Boolean
Constructor Details
#initialize(model_class, *args, &block) ⇒ FinderProxy
Returns a new instance of FinderProxy.
29 30 31 32 33 |
# File 'lib/friendly_id/active_record_adapter/finders.rb', line 29 def initialize(model_class, *args, &block) @model_class = model_class @ids = args.shift @options = args.first.kind_of?(Hash) ? args.first : {} end |
Instance Attribute Details
#finder ⇒ Object (readonly)
Perform the find query.
36 37 38 |
# File 'lib/friendly_id/active_record_adapter/finders.rb', line 36 def finder @finder end |
#finder_class ⇒ Object (readonly)
Returns the value of attribute finder_class.
22 23 24 |
# File 'lib/friendly_id/active_record_adapter/finders.rb', line 22 def finder_class @finder_class end |
#ids ⇒ Object (readonly)
Returns the value of attribute ids.
23 24 25 |
# File 'lib/friendly_id/active_record_adapter/finders.rb', line 23 def ids @ids end |
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class.
24 25 26 |
# File 'lib/friendly_id/active_record_adapter/finders.rb', line 24 def model_class @model_class end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
25 26 27 |
# File 'lib/friendly_id/active_record_adapter/finders.rb', line 25 def @options end |
Instance Method Details
#multiple? ⇒ Boolean
44 45 46 |
# File 'lib/friendly_id/active_record_adapter/finders.rb', line 44 def multiple? ids.kind_of? Array end |