2017/04/28分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Add documentation of data attributes for UJS [ci skip]
rails guideのWorking with JavaScript in Rails
の修正です。
rails-ujsでのdata attributes(data-method
、data-disable-with
等)の指定の方法や扱われか方等についての説明を追加しています。
Evaluate belongs_to :default option against the owner, not the association
activerecord/lib/active_record/associations/belongs_to_association.rb
の修正です。
belongs_to
のdefault
オプションに指定したblockを実行する際、associationに対して実行していたのを、associationが定義されているmodelの元で実行するよう修正しています。
PRより。
# app/models/ship.rb class Ship < ApplicationRecord belongs_to :developer, default: -> { default_developer } def default_developer Developer.first end end
というクラスがあった場合に、
# before ship = Ship.create! NameError: undefined local variable or method `default_developer' for #<ActiveRecord::Associations::BelongsToAssociation:0x0056312d94b8d0> # after ship = Ship.create! # => #<Ship id: 1, developer_id: 1>
のように、modelで定義したメソッドが呼べるようになっています。
Also raise error when VERSION is nil
activerecord/lib/active_record/railties/databases.rake
の修正です。
VERSION
envを指定せずにdb:migrate:up
、db:migrate:down
を実行してもエラーにならないバグがあったのを修正しています。
Ensure input to distance_of_time_in_words is not nil
actionview/lib/action_view/helpers/date_helper.rb
の修正です。
distance_of_time_in_words
メソッドの引数に不正な値(nil等)を指定した場合のエラーメッセージの改善、及び、from_time
、to_time
引数にTime / Date objectとNumericが混在した場合に正常に動作するよう修正しています。
# before helper.time_ago_in_words(nil) # => NoMethodError: undefined method `>' for nil:NilClass helper.distance_of_time_in_words(Date.current, 0) # => NoMethodError: undefined method `/' for 2017-04-28 00:00:00 +0900:Time # after helper.time_ago_in_words(nil) # => ArgumentError: nil can't be converted to a Time value helper.distance_of_time_in_words(Date.current, 0) # => "over 47 years"
Merge pull request #28844 from kyuden/remove_unnecessary_attributes_of_select_in_form_with
actionview/lib/action_view/helpers/tags/base.rb
の修正です。
form_with
が生成するformの中でselect
タグを生成する際に、不要なskip_default_ids
、allow_method_names_outside_object
attributesが付与されてしまっていたのを、付与されないよう修正しています。
Added some more release notes for Active Record [ci skip]
rails guideのRuby on Rails 5.1 Release Notes
の修正です。
Active Record
の項にエントリーを追加しています。
rails guideのRuby on Rails 5.1 Release Notes
の修正です。
Active Record
の項のエントリーのインデントがずれていたのを調整しています。
rails guideのWorking with JavaScript in Rails
の修正です。
グラマーの修正を行っています。
rails guideのRuby on Rails 5.1 Release Notes
の修正です。
グラマーの修正を行っています。
5.1 Release Notes are complete [ci skip]
guides/source/documents.yaml
の修正です。
Ruby on Rails 5.1 Release Notes
からWIPを削除し、リリースしています。