From 64d4571f6c96455eaed13bc5f2daf94e330ce4d5 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Tue, 27 Oct 2015 20:12:31 +0900 Subject: [ci skip] Aline code examples in AR changelog --- activerecord/CHANGELOG.md | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'activerecord/CHANGELOG.md') 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* -- cgit v1.2.3