diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-08-02 13:10:32 -0400 |
---|---|---|
committer | Neeraj Singh <neerajdotname@gmail.com> | 2010-08-02 13:10:32 -0400 |
commit | db0e3e5ad1db9bc0204db1dbc4075180bce3bc93 (patch) | |
tree | b88e6837d574334f6ead371561bdc43ff42f24b9 /activerecord | |
parent | d3eacf9352ee34e2965c0b1781cdb8a1799686ec (diff) | |
download | rails-db0e3e5ad1db9bc0204db1dbc4075180bce3bc93.tar.gz rails-db0e3e5ad1db9bc0204db1dbc4075180bce3bc93.tar.bz2 rails-db0e3e5ad1db9bc0204db1dbc4075180bce3bc93.zip |
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.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 11 |
1 files changed, 4 insertions, 7 deletions
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 <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) |