Permalink
Browse files

fix typo and remove 'examples' noise [ci skip]

  • Loading branch information...
1 parent 39e872b commit a3d18d2ec0d73ed8eb92c913e324884aab7aa85b Francesco Rodriguez committed May 28, 2012
Showing with 6 additions and 18 deletions.
  1. +6 −18 activerecord/lib/active_record/relation/finder_methods.rb
View
24 activerecord/lib/active_record/relation/finder_methods.rb
@@ -7,8 +7,6 @@ module FinderMethods
# 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 @@ def find(*args)
#
# 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 @@ def find_by!(*args)
# 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 @@ def take!
# 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 @@ def first!
# 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 @@ def last!
# 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 @@ def all
# '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}%"])

0 comments on commit a3d18d2

Please sign in to comment.