class FriendlyId::Status
FriendlyId::Status presents information about the status of the id that was used to find the model. This class can be useful for figuring out when to redirect to a new URL.
Attributes
name[RW]
The id or name used as the finder argument
record[RW]
The found result, if any
Public Class Methods
new(options={})
click to toggle source
# File lib/friendly_id/status.rb, line 14 def initialize(options={}) options.each {|key, value| self.send("#{key}=".to_sym, value)} end
Public Instance Methods
best?()
click to toggle source
Did the find operation use the best available id?
# File lib/friendly_id/status.rb, line 29 def best? record.friendly_id ? friendly? : true end
friendly?()
click to toggle source
Did the find operation use a friendly id?
# File lib/friendly_id/status.rb, line 19 def friendly? !! name end
numeric?()
click to toggle source
Did the find operation use a numeric id?
# File lib/friendly_id/status.rb, line 24 def numeric? !friendly? end