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
オプションの項を参照するよう説明及びリンクを追加しています。