Skip to content
This repository
Browse code

Correcting the documentation which wrongly states that each dynamic f…

…inder creates

method on the class. Only dynamic finders using <tt>scoped_by_*</tt> creates new
methods.
  • Loading branch information...
commit db0e3e5ad1db9bc0204db1dbc4075180bce3bc93 1 parent d3eacf9
Neeraj Singh authored August 02, 2010

Showing 1 changed file with 4 additions and 7 deletions. Show diff stats Hide diff stats

  1. 11  activerecord/lib/active_record/base.rb
11  activerecord/lib/active_record/base.rb
@@ -966,17 +966,14 @@ def compute_table_name
966 966
           end
967 967
         end
968 968
 
969  
-        # Enables dynamic finders like <tt>find_by_user_name(user_name)</tt> and 
970  
-        # <tt>find_by_user_name_and_password(user_name, password)</tt> that are turned into 
971  
-        # <tt>where(:user_name => user_name).first</tt> and 
972  
-        # <tt>where(:user_name => user_name, :password => :password).first</tt>
973  
-        # respectively. Also works for <tt>all</tt> by using <tt>find_all_by_amount(50)</tt> 
974  
-        # that is turned into <tt>where(:amount => 50).all</tt>.
  969
+        # Enables dynamic finders like <tt>User.find_by_user_name(user_name)</tt> and 
  970
+        # <tt>User.scoped_by_user_name(user_name). Refer to Dynamic attribute-based finders
  971
+        # section at the top of this file for more detailed information.
975 972
         #
976 973
         # It's even possible to use all the additional parameters to +find+. For example, the 
977 974
         # full interface for +find_all_by_amount+ is actually <tt>find_all_by_amount(amount, options)</tt>.
978 975
         #
979  
-        # Each dynamic finder, scope or initializer/creator is also defined in the class after it 
  976
+        # Each dynamic finder using <tt>scoped_by_*</tt> is also defined in the class after it 
980 977
         # is first invoked, so that future attempts to use it do not run through method_missing.
981 978
         def method_missing(method_id, *arguments, &block)
982 979
           if match = DynamicFinderMatch.match(method_id)

0 notes on commit db0e3e5

Please sign in to comment.
Something went wrong with that request. Please try again.