Module: FriendlyId::NonSluggableInstanceMethods

Defined in:
lib/friendly_id/non_sluggable_instance_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#found_using_friendly_idObject

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?

Returns:

  • (Boolean)


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?

Returns:

  • (Boolean)


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_idObject 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 friendly_id_options[:column]
end

#to_paramObject

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