diff options
author | yui-knk <spiketeika@gmail.com> | 2015-10-27 20:12:31 +0900 |
---|---|---|
committer | yui-knk <spiketeika@gmail.com> | 2015-10-27 20:12:31 +0900 |
commit | 64d4571f6c96455eaed13bc5f2daf94e330ce4d5 (patch) | |
tree | 02300b9c489be38c1fb7d06b2d2a3111af5053ca | |
parent | 190c69ece3a94dbd92f84833491d1b7b1bad06ea (diff) | |
download | rails-64d4571f6c96455eaed13bc5f2daf94e330ce4d5.tar.gz rails-64d4571f6c96455eaed13bc5f2daf94e330ce4d5.tar.bz2 rails-64d4571f6c96455eaed13bc5f2daf94e330ce4d5.zip |
[ci skip] Aline code examples in AR changelog
-rw-r--r-- | activerecord/CHANGELOG.md | 31 |
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* |