Sha256: 3be9231fba196672028d876a7356ccdc1a34f4c1a50b722966605b928edc0318
Contents?: true
Size: 774 Bytes
Versions: 60
Compression:
Stored size: 774 Bytes
Contents
module FriendlyId # 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. class Status # The id or name used as the finder argument attr_accessor :name # The found result, if any attr_accessor :record def initialize(options={}) options.each {|key, value| self.send("#{key}=".to_sym, value)} end # Did the find operation use a friendly id? def friendly? !! name end # Did the find operation use a numeric id? def numeric? !friendly? end # Did the find operation use the best available id? def best? record.friendly_id ? friendly? : true end end end
Version data entries
60 entries across 60 versions & 4 rubygems