diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-28 02:55:11 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-28 02:55:11 -0500 |
commit | a3d18d2ec0d73ed8eb92c913e324884aab7aa85b (patch) | |
tree | d964e00d7f8dae33654ba304494c275d9c6a753a | |
parent | 39e872b42bf58828e0757c247ace0c6048491614 (diff) | |
download | rails-a3d18d2ec0d73ed8eb92c913e324884aab7aa85b.tar.gz rails-a3d18d2ec0d73ed8eb92c913e324884aab7aa85b.tar.bz2 rails-a3d18d2ec0d73ed8eb92c913e324884aab7aa85b.zip |
fix typo and remove 'examples' noise [ci skip]
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 3d6a7a9d86..5f6898b45a 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -7,8 +7,6 @@ module ActiveRecord # If no record can be found for all of the listed ids, then RecordNotFound will be raised. If the primary key # is an integer, find by id coerces its arguments using +to_i+. # - # ==== Examples - # # Person.find(1) # returns the object for ID = 1 # Person.find("1") # returns the object for ID = 1 # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6) @@ -49,7 +47,6 @@ module ActiveRecord # # Post.find_by name: 'Spartacus', rating: 4 # Post.find_by "published_at < ?", 2.weeks.ago - # def find_by(*args) where(*args).take end @@ -64,8 +61,6 @@ module ActiveRecord # order. The order will depend on the database implementation. # If an order is supplied it will be respected. # - # Examples: - # # Person.take # returns an object fetched by SELECT * FROM people # Person.take(5) # returns 5 objects fetched by SELECT * FROM people LIMIT 5 # Person.where(["name LIKE '%?'", name]).take @@ -82,13 +77,11 @@ module ActiveRecord # Find the first record (or first N records if a parameter is supplied). # If no order is defined it will order by primary key. # - # Examples: - # # Person.first # returns the first object fetched by SELECT * FROM people # Person.where(["user_name = ?", user_name]).first # Person.where(["user_name = :u", { :u => user_name }]).first # Person.order("created_on DESC").offset(5).first - # Person.first(3) # returns the first 3 objects fetched by SELECT * FROM people LIMIT 3 + # Person.first(3) # returns the first three objects fetched by SELECT * FROM people LIMIT 3 def first(limit = nil) if limit if order_values.empty? && primary_key @@ -110,20 +103,18 @@ module ActiveRecord # Find the last record (or last N records if a parameter is supplied). # If no order is defined it will order by primary key. # - # Examples: - # # Person.last # returns the last object fetched by SELECT * FROM people # Person.where(["user_name = ?", user_name]).last # Person.order("created_on DESC").offset(5).last - # Person.last(3) # returns the last 3 objects fetched by SELECT * FROM people. + # Person.last(3) # returns the last three objects fetched by SELECT * FROM people. # - # Take note that in that last case, the results are sorted in ascending order: + # Take note that in that last case, the results are sorted in ascending order: # - # [#<Person id:2>, #<Person id:3>, #<Person id:4>] + # [#<Person id:2>, #<Person id:3>, #<Person id:4>] # - # and not + # and not: # - # [#<Person id:4>, #<Person id:3>, #<Person id:2>] + # [#<Person id:4>, #<Person id:3>, #<Person id:2>] def last(limit = nil) if limit if order_values.empty? && primary_key @@ -145,8 +136,6 @@ module ActiveRecord # Runs the query on the database and returns records with the used query # methods. # - # Examples: - # # Person.all # returns an array of objects for all the rows fetched by SELECT * FROM people # Person.where(["category IN (?)", categories]).limit(50).all # Person.where({ :friends => ["Bob", "Steve", "Fred"] }).all @@ -176,7 +165,6 @@ module ActiveRecord # 'Jamie'</tt>), since it would be sanitized and then queried against # the primary key column, like <tt>id = 'name = \'Jamie\''</tt>. # - # ==== Examples # Person.exists?(5) # Person.exists?('5') # Person.exists?(['name LIKE ?', "%#{query}%"]) |