Skip to content
This repository
Browse code

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

  • Loading branch information...
commit a3d18d2ec0d73ed8eb92c913e324884aab7aa85b 1 parent 39e872b
Francesco Rodríguez frodsan authored

Showing 1 changed file with 6 additions and 18 deletions. Show diff stats Hide diff stats

  1. +6 18 activerecord/lib/active_record/relation/finder_methods.rb
24 activerecord/lib/active_record/relation/finder_methods.rb
@@ -7,8 +7,6 @@ module FinderMethods
7 7 # If no record can be found for all of the listed ids, then RecordNotFound will be raised. If the primary key
8 8 # is an integer, find by id coerces its arguments using +to_i+.
9 9 #
10   - # ==== Examples
11   - #
12 10 # Person.find(1) # returns the object for ID = 1
13 11 # Person.find("1") # returns the object for ID = 1
14 12 # Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6)
@@ -49,7 +47,6 @@ def find(*args)
49 47 #
50 48 # Post.find_by name: 'Spartacus', rating: 4
51 49 # Post.find_by "published_at < ?", 2.weeks.ago
52   - #
53 50 def find_by(*args)
54 51 where(*args).take
55 52 end
@@ -64,8 +61,6 @@ def find_by!(*args)
64 61 # order. The order will depend on the database implementation.
65 62 # If an order is supplied it will be respected.
66 63 #
67   - # Examples:
68   - #
69 64 # Person.take # returns an object fetched by SELECT * FROM people
70 65 # Person.take(5) # returns 5 objects fetched by SELECT * FROM people LIMIT 5
71 66 # Person.where(["name LIKE '%?'", name]).take
@@ -82,13 +77,11 @@ def take!
82 77 # Find the first record (or first N records if a parameter is supplied).
83 78 # If no order is defined it will order by primary key.
84 79 #
85   - # Examples:
86   - #
87 80 # Person.first # returns the first object fetched by SELECT * FROM people
88 81 # Person.where(["user_name = ?", user_name]).first
89 82 # Person.where(["user_name = :u", { :u => user_name }]).first
90 83 # Person.order("created_on DESC").offset(5).first
91   - # Person.first(3) # returns the first 3 objects fetched by SELECT * FROM people LIMIT 3
  84 + # Person.first(3) # returns the first three objects fetched by SELECT * FROM people LIMIT 3
92 85 def first(limit = nil)
93 86 if limit
94 87 if order_values.empty? && primary_key
@@ -110,20 +103,18 @@ def first!
110 103 # Find the last record (or last N records if a parameter is supplied).
111 104 # If no order is defined it will order by primary key.
112 105 #
113   - # Examples:
114   - #
115 106 # Person.last # returns the last object fetched by SELECT * FROM people
116 107 # Person.where(["user_name = ?", user_name]).last
117 108 # Person.order("created_on DESC").offset(5).last
118   - # Person.last(3) # returns the last 3 objects fetched by SELECT * FROM people.
  109 + # Person.last(3) # returns the last three objects fetched by SELECT * FROM people.
119 110 #
120   - # Take note that in that last case, the results are sorted in ascending order:
  111 + # Take note that in that last case, the results are sorted in ascending order:
121 112 #
122   - # [#<Person id:2>, #<Person id:3>, #<Person id:4>]
  113 + # [#<Person id:2>, #<Person id:3>, #<Person id:4>]
123 114 #
124   - # and not
  115 + # and not:
125 116 #
126   - # [#<Person id:4>, #<Person id:3>, #<Person id:2>]
  117 + # [#<Person id:4>, #<Person id:3>, #<Person id:2>]
127 118 def last(limit = nil)
128 119 if limit
129 120 if order_values.empty? && primary_key
@@ -145,8 +136,6 @@ def last!
145 136 # Runs the query on the database and returns records with the used query
146 137 # methods.
147 138 #
148   - # Examples:
149   - #
150 139 # Person.all # returns an array of objects for all the rows fetched by SELECT * FROM people
151 140 # Person.where(["category IN (?)", categories]).limit(50).all
152 141 # Person.where({ :friends => ["Bob", "Steve", "Fred"] }).all
@@ -176,7 +165,6 @@ def all
176 165 # 'Jamie'</tt>), since it would be sanitized and then queried against
177 166 # the primary key column, like <tt>id = 'name = \'Jamie\''</tt>.
178 167 #
179   - # ==== Examples
180 168 # Person.exists?(5)
181 169 # Person.exists?('5')
182 170 # Person.exists?(['name LIKE ?', "%#{query}%"])

0 comments on commit a3d18d2

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