2017/03/13分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
First editing pass on “Active Model Basics” guide
rails guideのActive Model Basics
の修正です。
言い回し、グラマー、フォーマットの修正等をまとめて行っています。
Second editing pass on “Active Model Basics” guide
rails guideのActive Model Basics
の修正です。
引き続き、言い回し、グラマー、フォーマットの修正等をまとめて行っています。
Merge pull request #28372 from kamipo/delegate_as_json
activerecord/lib/active_record/relation.rb
、
activerecord/lib/active_record/relation/delegation.rb
の修正です。
ActiveRecord::Relation
クラスにas_json
メソッドを明示的に定義していたのをやめて、recordsにdelegateするメソッドの一覧にas_json
を追加しています。as_json
メソッドの中身がrecords
のas_json
を呼び出すだけだった為。
rails guideのActive Model Basics
の修正です。
先のActive Model Basics
guideの修正で、Dirty
の項にあるexampleコードを誤って修正してしまっていたのを戻しています。
Merge pull request #28371 from kamipo/simplify_count
activerecord/lib/active_record/relation/calculations.rb
の修正です。
Calculations#count
、#sum
メソッドで、引数にblockが与えられていた場合は、親クラスのメソッドを呼び出すよう修正しています。
def count(column_name = nil) - if block_given? - to_a.count { |*block_args| yield(*block_args) } - else - calculate(:count, column_name) - end + return super() if block_given? + calculate(:count, column_name) end
ActiveRecord::Relation
はEnumerable
をincludeしており、count
もsum
も使える為。
Merge pull request #28352 from alpaca-tc/fixes_renderer_with_defaults
actionpack/lib/action_controller/renderer.rb
の修正です。
ActionController::Renderer#with_defaults
メソッドがタイポによりNameError
でエラーになってしまうバグがあったのを修正しています。
def with_defaults(defaults) - self.class.new controller, env, self.defaults.merge(defaults) + self.class.new controller, @env, self.defaults.merge(defaults) end
Merge pull request #28017 from mtsmfm/suppress-dep-warn
Active Recordのテストの修正です。
Active Recordのテストでto_yamlに関するdeprecateメッセージ(implementing to_yaml is deprecated, please implement "encode_with"
)が出ていたのを、出ないよう対応(to_yaml
が定義されていたらundefするよう対応)しています。
Object
をdelegateしているクラスに対してYAML.dump
を呼び出した場合に発生してしまうとのことです。
参考:Bug #13115: `YAML.dump` outputs deperecated message even with delegated object
Merge pull request #28185 from renchap/system-testing-screenshot-output
actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb
の修正です。
system testingのスクリーンショット取得処理(#take_screenshot
)で必ずターミナルにスクリーンショットを表示していたのを、環境変数(RAILS_SYSTEM_TESTING_SCREENSHOT
)によって表示の仕方を調整出来るよう修正しています。
RAILS_SYSTEM_TESTING_SCREENSHOT
に指定出来る値はinline
(デフォルト。iTerm image protocol (http://iterm2.com/documentation-images.html)で表示。)、simple
(スクリーンショットのファイルのパスだけ表示)、artifact
(terminal artifact format (http://buildkite.github.io/terminal/inline-images/) で表示)の3つです。