lib/friendly_id.rb
# Finds the record using only the friendly id. If it can't be found
# using the friendly id, then it returns false. If you pass in any
# argument other than an instance of String or Array, then it also 
# returns false.
# def find_using_friendly_id()
#   return false unless slug_text.kind_of?(String)
#   finder = "find_by_#{self.friendly_id_options[:method].to_s}".to_sym
#   record = send(finder, slug_text)
#   record.send(:found_using_friendly_id=, true) if record
#   return record
# end
Finds the record using only the friendly id. If it can't be found
using the friendly id, then it returns false. If you pass in any
argument other than an instance of String or Array, then it also
returns false.
Finds the record using only the friendly id . If it can ' t be found using the friendly id then it returns false . If you pass in any argument other than an instance of String or Array then it also returns false .
def find_using_friendly_id(slug_text, options = {})
        case slug_text
          when String
            finder = "find_by_#{self.friendly_id_options[:method].to_s}".to_sym
          when Array
            finder = "find_all_by_#{self.friendly_id_options[:method].to_s}".to_sym
          else
            return false
        end
        records = send(finder, slug_text, options)
        [*records].each { |record| record.send(:found_using_friendly_id=, true) } unless records.blank?
        return records
      end
def find_using_friendly_id ( slug_text , options = { } ) case slug_text when String finder = "find_by_#{self.friendly_id_options[:method].to_s}" . to_sym when Array finder = "find_all_by_#{self.friendly_id_options[:method].to_s}" . to_sym else return false end records = send ( finder , slug_text , options ) [ * records ] . each { | record | record . send ( :found_using_friendly_id= , true ) } unless records . blank? return records end
Finds the record using only the friendly id.
Finds the record using only the friendly id .
slug_text
options