Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/friendly_id.rb
Instance Method Summary (collapse)
-
- (true, ...) friendly_id?
Is the object a friendly id? Note that the return value here is
false
if theid
is definitely not friendly, andnil
if it can not be determined. -
- (true, ...) unfriendly_id?
Is the object a numeric id?.
Instance Method Details
- (true, ...) friendly_id?
Is the object a friendly id? Note that the return value here is
false
if the id
is definitely not friendly, and
nil
if it can not be determined. The return value will be:
-
true
- if the id is definitely friendly (i.e., a string with non-numeric characters) -
false
- if the id is definitely unfriendly (i.e., an Integer, a model instance, etc.) -
nil
- if it can not be determined (i.e., a numeric string like “206”.)
76 77 78 79 80 81 82 |
# File 'lib/friendly_id.rb', line 76 def friendly_id? if kind_of?(Integer) or kind_of?(Symbol) or self.class.respond_to? :friendly_id_config false elsif to_i.to_s != to_s true end end |
- (true, ...) unfriendly_id?
Is the object a numeric id?
88 89 90 |
# File 'lib/friendly_id.rb', line 88 def unfriendly_id? val = friendly_id? ; !val unless val.nil? end |