Class: FriendlyId::Slugged::Status
- Inherits:
-
FriendlyId::Status
- Object
- FriendlyId::Status
- FriendlyId::Slugged::Status
- Defined in:
- lib/friendly_id/slugged.rb
Instance Attribute Summary (collapse)
-
- (Object) sequence
Returns the value of attribute sequence.
-
- (Object) slug
The slug that was used to find the model.
Attributes inherited from FriendlyId::Status
Instance Method Summary (collapse)
-
- (Boolean) best?
Did the find operation use the best possible id? True if
id
is numeric, but the model has no slug, orid
is friendly and current. -
- (Boolean) current?
Did the find operation use the current slug?.
-
- (Boolean) friendly?
Did the find operation use a friendly id?.
- - (Object) friendly_id=(friendly_id)
-
- (Boolean) outdated?
Did the find operation use an outdated slug?.
Methods inherited from FriendlyId::Status
Constructor Details
This class inherits a constructor from FriendlyId::Status
Instance Attribute Details
- (Object) sequence
Returns the value of attribute sequence
6 7 8 |
# File 'lib/friendly_id/slugged.rb', line 6 def sequence @sequence end |
- (Object) slug
The slug that was used to find the model.
34 35 36 |
# File 'lib/friendly_id/slugged.rb', line 34 def slug @slug end |
Instance Method Details
- (Boolean) best?
Did the find operation use the best possible id? True if id
is
numeric, but the model has no slug, or id
is friendly and
current
10 11 12 |
# File 'lib/friendly_id/slugged.rb', line 10 def best? current? || (numeric? && !record.slug) end |
- (Boolean) current?
Did the find operation use the current slug?
15 16 17 |
# File 'lib/friendly_id/slugged.rb', line 15 def current? !! slug && slug.current? end |
- (Boolean) friendly?
Did the find operation use a friendly id?
20 21 22 |
# File 'lib/friendly_id/slugged.rb', line 20 def friendly? !! (name or slug) end |
- (Object) friendly_id=(friendly_id)
24 25 26 |
# File 'lib/friendly_id/slugged.rb', line 24 def friendly_id=(friendly_id) @name, @sequence = friendly_id.parse_friendly_id(record.friendly_id_config.sequence_separator) end |
- (Boolean) outdated?
Did the find operation use an outdated slug?
29 30 31 |
# File 'lib/friendly_id/slugged.rb', line 29 def outdated? !current? end |