2016/06/03分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Active Recordの修正です。
先日コミットされた、Active Recordのインスタンスをyamlに変換した際にyamlに保持してなくても問題無いデータは含まないようした対応(
Make Active Record emit significantly smaller YAML)、及びadd_references
メソッドのforeign_key
オプションにHashを指定した場合にrollback処理でエラーになってしまうのを修正した対応(Respect options passed to foreign_key
when reverting add_reference
)で、テストが壊れてしまっていたのを、まとめて対応しています。
rails guideのGetting Started with Engines
の修正です。
What are engines?
の項のグラマーの修正を行っています。
Ensure that records with unselected fields can be updated
activerecord/lib/active_record/attribute.rb
の修正です。
select
で選択しなかったattributesを更新しようとした場合に、NotImplementedError
がraiseしてしまうバグがあったのを修正しています。
issueより。
ActiveRecord::Schema.define do create_table :people, force: true do |t| t.string :name t.string :color t.datetime :created_on t.datetime :updated_on end end class Person < ActiveRecord::Base end
person = Person.where(name: 'Joe').select(:id, :name).first person.update(color: 'blue') #=> NotImplementedError
ActiveRecord::Attribute::Uninitialized
クラスにoriginal_value
メソッドが無かった為エラーになってしまっていたので、メソッドを追加し対応しています。
actionview/test/activerecord/debug_helper_test.rb
の修正です。
先に行われたFix failing testsの対応で、テストの修正漏れがあったので、追加で対応しています。
Don't blank pad day of the month when formatting dates
activesupport/lib/active_support/core_ext/date/conversions.rb
の修正です。
Dateクラスのデフォルトのformatで、%e
の代わりに%d
を使用するよう修正しています。
class Date DATE_FORMATS = { - :short => '%e %b', - :long => '%B %e, %Y', + :short => '%d %b', + :long => '%B %d, %Y', :db => '%Y-%m-%d', :number => '%Y%m%d', :long_ordinal => lambda { |date| day_format = ActiveSupport::Inflector.ordinalize(date.day) date.strftime("%B #{day_format}, %Y") # => "April 25th, 2007" }, - :rfc822 => '%e %b %Y', + :rfc822 => '%d %b %Y', :iso8601 => lambda { |date| date.iso8601 } }
%e
だと1桁の日にちのときにスペースが入ってしまい、これは望ましく無い挙動なのでは、との事で修正されたようです。
# before Date.today.to_formatted_s(:long) #=> "June 3, 2016 # after Date.today.to_formatted_s(:long) #=> "June 03, 2016"
参考:instance method Time#strftime (Ruby 2.3.0)
[skip ci] Make header bullets consistent in engines.md
rails guideのGetting Started with Engines
の修正です。
先頭の、このguideで学べる事について説明している箇所のリストを、How to〜
という言い回しに修正しています。
-* Building features for the engine. -* Hooking the engine into an application. -* Overriding engine functionality in the application. +* How to build features for the engine. +* How to hook the engine into an application. +* How to override engine functionality in the application.
他のguideと言い回しを合わせる為、との事です。
Merge pull request #25243 from sukesan1984/add_i18n_validation_test
activerecord/test/cases/validations/i18n_validation_test.rb
の修正です。
validation
にon
オプションを指定した場合のテストを追加しています。
activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
のdocの修正です。
Module#thread_mattr_reader
、Module#thread_mattr_writer
のdocのグラマーの修正を行っています。