From db0e3e5ad1db9bc0204db1dbc4075180bce3bc93 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Mon, 2 Aug 2010 13:10:32 -0400 Subject: Correcting the documentation which wrongly states that each dynamic finder creates method on the class. Only dynamic finders using scoped_by_* creates new methods. --- activerecord/lib/active_record/base.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 335f26d221..12736d3d5b 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -966,17 +966,14 @@ module ActiveRecord #:nodoc: end end - # Enables dynamic finders like find_by_user_name(user_name) and - # find_by_user_name_and_password(user_name, password) that are turned into - # where(:user_name => user_name).first and - # where(:user_name => user_name, :password => :password).first - # respectively. Also works for all by using find_all_by_amount(50) - # that is turned into where(:amount => 50).all. + # Enables dynamic finders like User.find_by_user_name(user_name) and + # User.scoped_by_user_name(user_name). Refer to Dynamic attribute-based finders + # section at the top of this file for more detailed information. # # It's even possible to use all the additional parameters to +find+. For example, the # full interface for +find_all_by_amount+ is actually find_all_by_amount(amount, options). # - # Each dynamic finder, scope or initializer/creator is also defined in the class after it + # Each dynamic finder using scoped_by_* is also defined in the class after it # is first invoked, so that future attempts to use it do not run through method_missing. def method_missing(method_id, *arguments, &block) if match = DynamicFinderMatch.match(method_id) -- cgit v1.2.3