Module: FriendlyId::NonSluggableInstanceMethods
- Defined in:
- lib/friendly_id/non_sluggable_instance_methods.rb
Instance Attribute Summary collapse
-
#found_using_friendly_id ⇒ Object
readonly
Returns the value of attribute found_using_friendly_id.
Instance Method Summary collapse
-
#found_using_friendly_id? ⇒ Boolean
Was the record found using one of its friendly ids?.
-
#found_using_numeric_id? ⇒ Boolean
(also: #has_better_id?)
Was the record found using its numeric id?.
-
#friendly_id ⇒ Object
(also: #best_id)
Returns the friendly_id.
-
#to_param ⇒ Object
Returns the friendly id, or if none is available, the numeric id.
Instance Attribute Details
#found_using_friendly_id ⇒ Object
Returns the value of attribute found_using_friendly_id.
3 4 5 |
# File 'lib/friendly_id/non_sluggable_instance_methods.rb', line 3 def found_using_friendly_id @found_using_friendly_id end |
Instance Method Details
#found_using_friendly_id? ⇒ Boolean
Was the record found using one of its friendly ids?
6 7 8 |
# File 'lib/friendly_id/non_sluggable_instance_methods.rb', line 6 def found_using_friendly_id? @found_using_friendly_id end |
#found_using_numeric_id? ⇒ Boolean Also known as: has_better_id?
Was the record found using its numeric id?
11 12 13 |
# File 'lib/friendly_id/non_sluggable_instance_methods.rb', line 11 def found_using_numeric_id? !@found_using_friendly_id end |
#friendly_id ⇒ Object Also known as: best_id
Returns the friendly_id.
17 18 19 |
# File 'lib/friendly_id/non_sluggable_instance_methods.rb', line 17 def friendly_id send [:column] end |
#to_param ⇒ Object
Returns the friendly id, or if none is available, the numeric id.
23 24 25 |
# File 'lib/friendly_id/non_sluggable_instance_methods.rb', line 23 def to_param friendly_id.to_s || id.to_s end |