Module: FriendlyId::FinderMethods
- Defined in:
- lib/friendly_id/finder_methods.rb
Overview
These methods will be added to the model's relation_class.
Instance Method Summary (collapse)
-
- (Boolean) exists?(id = false)
protected
FriendlyId overrides this method to make it possible to use friendly id's identically to numeric ids in finders.
-
- (Object) find_one(id)
protected
FriendlyId overrides this method to make it possible to use friendly id's identically to numeric ids in finders.
Instance Method Details
- (Boolean) exists?(id = false) (protected)
FriendlyId overrides this method to make it possible to use friendly id's identically to numeric ids in finders.
30 31 32 33 |
# File 'lib/friendly_id/finder_methods.rb', line 30 def exists?(id = false) return super if id.unfriendly_id? super @klass.friendly_id_config.query_field => id end |
- (Object) find_one(id) (protected)
FriendlyId overrides this method to make it possible to use friendly id's identically to numeric ids in finders.
15 16 17 18 |
# File 'lib/friendly_id/finder_methods.rb', line 15 def find_one(id) return super if id.unfriendly_id? where(@klass.friendly_id_config.query_field => id).first or super end |