2015/01/09分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Remove
ActionController::HideActions - Add prepend option to protect_from_forgery.
- Deprecate all _filter callbacks in favor of _action callbacks
Add test case and documentation for skip_before_filter.
actionpack/lib/abstract_controller/callbacks.rb、
actionpack/test/controller/filters_test.rbの修正です。
skip_before_actionメソッドにonlyオプションとifオプションを同時に使用した場合のテストとdocへの説明を追加しています。
Add test/doc for :if/:except in skip_before_action
actionpack/lib/abstract_controller/callbacks.rb、
actionpack/test/controller/filters_test.rbの修正です。
skip_before_actionメソッドにifオプションとexceptオプションを同時に使用した場合のテストとdocへの説明を追加しています。
Document has_many :extend option
activerecord/lib/active_record/associations.rbのdocの修正です。
has_manyメソッドのextendオプションについての説明をdocに追加しています。
module NamedExtension def greeting "hello" end end class User < ActiveRecord::Base has_many :tags, extend: NamedExtension end User.first.tags.greeting # => "hello"
Merge pull request #18371 from brainopia/remove_hide_actions
ActionController::HideActionsモジュールを削除しています。
HideActionsはコントローラクラス内のpublicメソッドをactionとして使いたく無い時の為のmoduleだったのですが、
今そんな使い方しないよね、という事で削除されたようです。
Add prepend option to protect_from_forgery.
protect_from_forgeryメソッドにprependオプションを追加しています。
元々protect_from_forgeryメソッドは一番最初に前処理が行われていたのですが、prepend: falseを設定すると、普通にbefore_actionとして追加されるので、protect_from_forgeryより前に前処理を実施する事が出来ます。
class ApplicationController < ActionController::Base before_action :authenticate protect_from_forgery prepend: false, unless: -> { @authenticated_by.oauth? } private def authenticate if oauth_request? # authenticate with oauth @authenticated_by = 'oauth'.inquiry else # authenticate with cookies @authenticated_by = 'cookie'.inquiry end end end
actionpack/CHANGELOG.mdの修正です。
先に追加されたprotect_from_forgeryの対応についてのexampleを修正しています。
actionpack/CHANGELOG.mdの修正です。
先に追加されたprotect_from_forgeryの対応についてのexampleを修正しています。2回目。
Deprecate all _filter callbacks in favor of _action callbacks
actionpack/lib/abstract_controller/callbacks.rbの修正です。
*filter callbacks を使用した際にdeprecateメッセージを表示するよう修正しています。filter はRails 5.1で削除予定との事。
Rails 4.2で削除されてた気がしていたのですが、Rails 4.2ではドキュメントからの削除だけでした。
Add _mailer suffix to i18n path
actionmailer/lib/rails/generators/mailer/templates/mailer.rb、
railties/test/generators/mailer_generator_test.rbの修正です。
先日行われた_mailer suffixを追加する対応について、i18n pathについてのテストの対応が漏れていたので、追加しています。
ActiveRecord: release connection on reconnect failure.
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rbの修正です。
checkout_and_verifyメソッドでエラーが起きた際に、コネクションの切断処理(disconnect!)を行うよう修正しています。
Update rake counts to count declarative tests in minitest
railties/lib/rails/code_statistics_calculator.rbの修正です。
rake statsコマンドがtestメソッドで作成したテストコードをカウントして無かったので、カウントするよう修正しています。
Drop old test locations from rake stats
railties/lib/rails/code_statistics.rb、
railties/lib/rails/tasks/statistics.rakeの修正です。
rake statsの対象から、古いテスト用のディレクトリのtest/functional、 test/unitを削除しています。