2016/06/08分のコミットです。
CHANGELOGへの追加はありませんでした。
Merge pull request #25265 from opti/improve/hash_compact
activesupport/lib/active_support/core_ext/hash/compact.rbのdoc及び
activesupport/test/core_ext/hash_ext_test.rbの修正です。
Hash#compact及びHash#compact!メソッドで値が変わらない場合のexampleをdocに追加、及び同ケースのテストを追加しています。
Merge pull request #25235 from prathamesh-sonpatki/cleanup
railties/lib/rails/generators/rails/app/app_generator.rb、
rails/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.ttの修正です。
アプリのデフォルトの挙動を変えるinitalizers(new_framework_defaults.rb)の内容をrails newで経由で生成したか、rails app:updateで生成したかによって変えるよう修正しています。
rails app:updateで生成した場合。
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = false
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = false
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = false
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = true
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
rails newで生成した場合
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = true
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = true
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = true
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = true
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = false
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
rails app:updateで生成した場合は、過去の挙動と同じなるようにしています(ssl_optionsの値がちょっとおかしい気もするが)。
Flag to_time + simplify version names.
rails/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.ttの修正です。
ActiveSupport.to_time_preserves_timezoneの値も他のinitializer同様に、rails newで経由で生成したかrails app:updateで生成したかによって変えるよう修正しています。
Fix API controller tests by assigning them the encoding type
railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rbの修正です。
API-only Applicationsで生成されるcontrollerのテストで、httpシミュレーション用のメソッドを呼び出す際、asオプションを指定するよう修正しています。
- get <%= index_helper %>_url + get <%= index_helper %>_url, as: :json
ActionDispatch::IntegrationTestはformatの指定が無いと、formatにhtmlを指定し処理を行ってしまい、jbuilderのようなrender処理を行うライブラリを一緒に使用した場合、テストが正常に動作しない為追加しています(asオプションにjsonを指定するとJSON formatとして認識される)。
actionview/test/actionpack/controller/render_test.rbの修正です。
controller.processについてのテストを削除しています。他の適切な箇所でテストが既に行われている為。
Merge pull request #25079 from jeffkreeftmeijer/send_file-halts-request-cycle
actionpack/lib/abstract_controller/base.rb、
actionpack/lib/abstract_controller/callbacks.rbの修正です。
controller callbacksで、controllerが処理済みかどうかにresponse_bodyの値を見るようにしていたのを、performed?メソッドを使用するよう修正しています。
define_callbacks :process_action, - terminator: ->(controller, result_lambda) { result_lambda.call if result_lambda.is_a?(Proc); controller.response_body }, + terminator: ->(controller, result_lambda) { result_lambda.call if result_lambda.is_a?(Proc); controller.performed? },
ActionController::Metal::DataStreaming#send_fileでは@_response_bodyに値を設定してないので、response bodyを送信済みでも、response_bodyがnilのままで、正しく値を送信済みかどうかのチェックが出来ない為のようです。
Add regression test to as option.
actionpack/test/controller/integration_test.rbの修正です。
ActionDispatch::IntegrationTest#postメソッドに、JSON encodingを指定した場合のテストを追加しています。
Merge pull request #25247 from y-yagi/reference_actual_class
railties/test/railties/engine_test.rbの修正です。
Rails engineのテストで、config.middleware.useの引数にStringを指定していたのを、Classを指定するよう修正しています。Rails 5.0からStringを指定するのはdeprecateになった為。
Prevent { internal: true } from being stored in the router
actionpack/lib/action_dispatch/routing/mapper.rbの修正です。
ActionDispatch::Routing::Mapper::Mapping::initializeでoptionsからinternalオプションの値を取得する際、値を削除するよう修正しています。
- @internal = options[:internal] + @internal = options.delete(:internal)
internalオプションはRailsが内部で定義したroutesかどうかを判別する為だけのオプションで、実際に使用するparameterでは無い為、parameterとして認識されるのを避ける為に削除するようにしたようです。
Add Action Cable introduction to release notes [ci skip]
rails guideのRuby on Rails 5.0 Release Notesの修正です。
Action Cableの項に詳細な説明を追加しています。
Add Rails 5.0 release notes to the index page of guides [ci skip]
guides/source/documents.yamlの修正です。
guideの一覧にRuby on Rails 5.0 Release Notesを追加しています。まだWIP。
[ci skip] Expand information on message options
rails guideのActive Record Validationsの修正です。
validationsのオプションにmessageオプションがある箇所に、messageオプションについての詳細は、:messageオプションの項を参照するよう説明及びリンクを追加しています。