Correcting the documentation which wrongly states that each dynamic finder creates

method on the class. Only dynamic finders using <tt>scoped_by_*</tt> creates new
methods.
This commit is contained in:
Neeraj Singh
2010-08-02 13:10:32 -04:00
parent d3eacf9352
commit db0e3e5ad1

View File

@@ -966,17 +966,14 @@ module ActiveRecord #:nodoc:
end
end
# Enables dynamic finders like <tt>find_by_user_name(user_name)</tt> and
# <tt>find_by_user_name_and_password(user_name, password)</tt> that are turned into
# <tt>where(:user_name => user_name).first</tt> and
# <tt>where(:user_name => user_name, :password => :password).first</tt>
# respectively. Also works for <tt>all</tt> by using <tt>find_all_by_amount(50)</tt>
# that is turned into <tt>where(:amount => 50).all</tt>.
# Enables dynamic finders like <tt>User.find_by_user_name(user_name)</tt> and
# <tt>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 <tt>find_all_by_amount(amount, options)</tt>.
#
# Each dynamic finder, scope or initializer/creator is also defined in the class after it
# Each dynamic finder using <tt>scoped_by_*</tt> 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)