Refer to ActiveRecord::Base documentation for Dynamic attribute-based finders for detailed info
# File lib/active_record/dynamic_finder_match.rb, line 8 8: def self.match(method) 9: df_match = self.new(method) 10: df_match.finder ? df_match : nil 11: end
# File lib/active_record/dynamic_finder_match.rb, line 13 13: def initialize(method) 14: @finder = :first 15: @bang = false 16: @instantiator = nil 17: 18: case method.to_s 19: when /^find_(all_by|last_by|by)_([_a-zA-Z]\w*)$/ 20: @finder = :last if $1 == 'last_by' 21: @finder = :all if $1 == 'all_by' 22: names = $2 23: when /^find_by_([_a-zA-Z]\w*)\!$/ 24: @bang = true 25: names = $1 26: when /^find_or_(initialize|create)_by_([_a-zA-Z]\w*)$/ 27: @instantiator = $1 == 'initialize' ? :new : :create 28: names = $2 29: else 30: @finder = nil 31: end 32: @attribute_names = names && names.split('_and_') 33: end
# File lib/active_record/dynamic_finder_match.rb, line 49 49: def bang? 50: @bang 51: end
# File lib/active_record/dynamic_finder_match.rb, line 45 45: def creator? 46: @finder == :first && @instantiator == :create 47: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.