aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-10-27 16:14:51 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2015-10-27 16:14:51 +0100
commit0174837bfa263c55cf727f23028d8f28da192d14 (patch)
treee1fd17ceb28bbb6560f3e1ad97e4374c92817304 /activerecord/CHANGELOG.md
parent7a9ce69ce081a0c186a23806c1af1f71c697ea77 (diff)
parent64d4571f6c96455eaed13bc5f2daf94e330ce4d5 (diff)
downloadrails-0174837bfa263c55cf727f23028d8f28da192d14.tar.gz
rails-0174837bfa263c55cf727f23028d8f28da192d14.tar.bz2
rails-0174837bfa263c55cf727f23028d8f28da192d14.zip
Merge pull request #22087 from yui-knk/fix_ar_changelog
[ci skip] Aline code examples in AR changelog
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md31
1 files changed, 14 insertions, 17 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 9961bfc99c..5e523d2aa6 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -4,19 +4,17 @@
now be indexed if :index_errors is specified when defining a
has_many relationship, or if its set in the global config.
- E.X.
+ Example:
- ```ruby
- class Guitar < ActiveRecord::Base
- has_many :tuning_pegs
- accepts_nested_attributes_for :tuning_pegs
- end
+ class Guitar < ActiveRecord::Base
+ has_many :tuning_pegs
+ accepts_nested_attributes_for :tuning_pegs
+ end
- class TuningPeg < ActiveRecord::Base
- belongs_to :guitar
- validates_numericality_of :pitch
- end
- ```
+ class TuningPeg < ActiveRecord::Base
+ belongs_to :guitar
+ validates_numericality_of :pitch
+ end
- Old style
- `guitar.errors["tuning_pegs.pitch"] = ["is not a number"]`
@@ -142,9 +140,8 @@
database.
- m = Model.create!
- m.created_at.usec == m.reload.created_at.usec
- # => false
+ m = Model.create!
+ m.created_at.usec == m.reload.created_at.usec # => false
# due to different precision in Time.now and database column
If the precision is low enough, (mysql default is 0, so it is always low
@@ -332,9 +329,9 @@
Example:
- @users = User.where("name like ?", "%Alberto%")
- @users.cache_key
- => "/users/query-5942b155a43b139f2471b872ac54251f-3-20150714212107656125000"
+ @users = User.where("name like ?", "%Alberto%")
+ @users.cache_key
+ # => "/users/query-5942b155a43b139f2471b872ac54251f-3-20150714212107656125000"
*Alberto Fernández-Capel*