2014/08/20分のコミットです。
rails 4.2 beta1がリリースされましたね。それもあってか、doc系の修正、Gemfile関係の修正が大量にありました。
そんな中、CHANGELOGにのったコミットは以下の通りです。
actionmailer/CHANGELOG.md
rails guideのCreating and Customizing Rails Generators & Templates
の修正です。
不要な行の削除。
Merge branch 'master' of github.com:rails/docrails
各docの修正です。
html -> HTML変換、ActionDispatch::FileHandler
、ActionDispatch::Static
クラスへのdocの追加等、docの改善。
custom configurationの改善です。
configに"x"のnamespace無しでHashの値を設定出来るように改善しています。
config.resque = ActiveSupport::OrderedOptions.new config.resque.inline_jobs = :always config.resque.timeout = 60
こんな感じで、最初のkeyにActiveSupport::OrderedOptions
を指定してあげる必要があるようです。
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
の修正です。
require 'active_support/core_ext/string/strip'
を追加しています。
Add default .raise_in_transactional_callbacks option to template
railties/lib/rails/generators/rails/app/templates/config/application.rb
の修正です。
テンプレートファイルに
<%- unless options.skip_active_record? -%> # For not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true <%- end -%>
を追加しています。
Move TimeHelperTest to TimeTravelTest from as/test_test.rb
TimeHelperTest
のテストをactivesupport/test/test_test.rb
からactivesupport/test/time_travel_test.rb
に移動しています。
Merge pull request #16299 from sikachu/ps-safer-ac-params
actionpack/lib/action_controller/metal/strong_parameters.rb
の修正です。
次のmajor updateでActionController::Parameters
クラスはHash
及びHashWithIndifferentAccess
を継承するのを止める予定で元々使っていた幾つかの処理が行えなくなります。
その為、ActionController::Parameters
にto_h
メソッドを追加し、同じような処理を行いたい場合、最初にto_h
メソッドでHashに変換する必要があるとの事です。
params = ActionController::Parameters.new({ name: 'Senjougahara Hitagi', oddity: 'Heavy stone crab' }) params.to_h # => {} unsafe_params = params.dup.permit! unsafe_params.to_h # => {"name"=>"Senjougahara Hitagi", "oddity"=>"Heavy stone crab"} safe_params = params.permit(:name) safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}
Protect against error when parsing parameters with Bad Request
actionpack/lib/action_dispatch/http/request.rb
の修正です。
GET
、POST
メソッドがrescueクラスに、Rack::Utils::InvalidParameterError
を追加しています。
- rescue TypeError => e + rescue TypeError, Rack::Utils::InvalidParameterError => e
元々InvalidParameterError
はTypeError
を継承していたので問題無かったのですが、rackのこのコミットでInvalidParameterError
クラスの親クラスをArgumentError
に変更している為、InvalidParameterErrorを追加したようです。
親クラスを変更するの、中々大きな対応な気がするのですが、ざっくりとやっちゃいますねえ。
Merge pull request #16349 from jmcnevin/master
activerecord/lib/active_record/migration.rb
の修正です。
schema_migrations
テーブルが無い場合に、ActiveRecord::Migrator.needs_migration?
が正常な値を返すよう修正しています。
loofah require dependecy is not needed anymore
Gemfile
、railties/lib/rails/generators/rails/app/templates/Gemfile
の修正です。
loofah
を削除しています。
Fix the rails-dom-testing dependecy
各gemspecの修正です。
rails-dom-testing
の追加及びバージョンの固定を行っています。
Bump ActiveJob's GlobalID dep to 0.2.3+ to fix Railties tests
activejob/activejob.gemspec
の修正です。
globalidのバージョン指定を追加しています。
Use released rails-deprecated_sanitizer
各gemspecの修正です。
rails-deprecated_sanitizerのバージョン指定を追加しています。
Use released rails-html-sanitizer
各gemspecの修正です。
'rails-html-sanitizer'について、githubのリポジトリを指定していいたのを削除しています。
Gemfile
の修正です。
rack及びglobalidを削除しています。
Add TODO note about the gems missing release
Gemfile
の修正です。
以下の内容TODOを追加しています。
+# TODO: remove this before the 4.2.0.beta1 release +gem 'turbolinks', github: 'rails/turbolinks', branch: 'master'
Move date and time requires to time_travel_test, also include
activesupport/test/time_travel_test.rb
の修正です。
'active_support/core_ext/date'、'active_support/core_ext/numeric/time'のrequireを追加しています。
We always get the value so no need to check nil or Hash
railties/lib/rails/railtie/configuration.rb
の修正です。
ChainedConfigurationOptions#initialize
メソッド引数の引数をが任意だったのを必須に変更しています。
[ci skip] Added documentation for belongs_to scope parameter
activerecord/lib/active_record/associations.rb
のdocの修正です。
belongs_to scopeについてのサンプルを追加しています。
belongs_to :user, -> { where(id: 2) } belongs_to :user, -> { joins(:friends) } belongs_to :level, ->(level) { where("game_level > ?", level.current) }
Mention web-console in 4.2 release notes
guides/source/4_2_release_notes.md
、railties/CHANGELOG.md
の修正です。
web-consoleについての説明を追加しています。
activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb
の修正です。
require 'rack/utils'
を追加しています。
Auth token mask from breach-mitigation-rails gem
actionpack/lib/action_controller/metal/request_forgery_protection.rb
の修正です。
auth tokenへのMask処理を追加しています。
SecureRandom.random_bytes
でone time padを作成して、作成したone time padとCSRF tokenをXORした暗号化したtokenを作成し、
そのtokenとone time padを加算してtokenを作成する、という処理を行っています。
BREACH攻撃などでCSRF tokenがハイジャックされてしまった時の為の対応のようです。
因みに、元々breach-mitigation-rails
というgemでやっていた内容を、rails本体にマージしたようです。
Revert "Improve custom configuration"
上で追加されたcustom configurationのコミットをrevertしています。リグレッションが発生した為との事です。追加はまた後で。
Require sprockets-rails 3.0.0.beta1
rails.gemspec
の修正です。
s.add_dependency 'sprockets-rails', '~> 3.0.0.beta1'
に修正しています。
Use web-console 2.0.0.beta2 on new apps
railties/lib/rails/generators/rails/app/templates/Gemfile
の修正です。
web-consoleについて、'2.0.0.beta1'固定だったのを'~> 2.0.0.beta2'に修正しています。
Synced Active Model changelogs [ci skip]
guides/source/4_2_release_notes.md
の修正です。
ActiveModelのchange logを反映しています。
Point to right sass-rails version
railties/lib/rails/generators/app_base.rb
の修正です。
sass-rails
のバージョン指定を5.0.0.beta1
に修正しています。
Fix setting simple values to the new config.x
railties/lib/rails/application/configuration.rb
の修正です。
custom configurationの改善のrevertされた事に伴い、元々のcustom configurationのサンプルがちゃんと動作するよう修正しています。
Use the released turbolinks gem
Gemfile
の修正です。
'turbolinks'について、githubのリポジトリを指定していいたのを削除しています。
Synced Active Support release notes [ci skip]
guides/source/4_2_release_notes.md
の修正です。
ActiveSupportのchange logを反映しています。
Merge pull request #16570 from bradleybuda/breach-mitigation-mask-csrf-token
Synced AR release notes [ci-skip]
guides/source/4_2_release_notes.md
の修正です。
ActiveRecordのchange logを反映しています。
Fix blank link on config/application.rb app template [ci skip]
railties/lib/rails/generators/rails/app/templates/config/application.rb
の修正です。
不要なスペースを削除しています。
railties/test/isolation/abstract_unit.rb
の修正です。
configにactive recordの項目が追加された事に伴いコケてしまっていたテストを修正しています。
Major features in 4.2 release notes [ci skip]
guides/source/4_2_release_notes.md
の修正です。
Major featuresについての説明を追加しています。
List the 4.2 release notes in the index, mark it as WIP [ci skip]
guides/source/documents.yaml
の修正です。
4_2_release_notesを追加しています。
Clearly mark these as WIP, and invite people to contribute. [ci skip]
guides/source/4_1_release_notes.md
、
guides/source/upgrading_ruby_on_rails.md
の修正です。
WIPである旨注意を追加しています。PR募集中。
Some placeholders for the 4.2 upgrade guide [ci skip]
guides/source/upgrading_ruby_on_rails.md
の修正です。
幾つか項のタイトルを追加しています。タイトルをだけで、内容はまだ。
:bomb: oops, it should be 4.2 that's WIP [ci skip]
guides/source/4_2_release_notes.md
、
guides/source/4_1_release_notes.md
の修正です。
4_2_release_notesの方に追加すべき内容を4_1の方に追加してしまっていたのを修正しています。
:nail_care: The note doesn't look good on the blue background [ci skip]
guides/source/4_2_release_notes.md
の修正です。
フォーマットの修正。
guides/source/4_2_release_notes.md
の修正です。
コピペが失敗した箇所を修正しています。
Create a group to active job gems
Gemfile
の修正です。
group :job
を追加して、ActiveJobに関係するgemをまとめています。
Add set_delivery_method
and restore_delivery_method
to ActionMailer::TestCase
.
actionmailer/lib/action_mailer/test_case.rb
の修正です。
set_delivery_method
、restore_delivery_method
メソッドをActionmailer::TestCase
に追加しています。
ActionMailer test suite外でも上記メソッドを使えるようにする為との事です。
actionmailer/CHANGELOG.md
の修正です。
不要なスペースの削除。
Remove global helpers from the ActionMailer test suite.
actionmailer/test/abstract_unit.rb
の修正です。
先程Actionmailer::TestCase
に追加したset_delivery_method
、restore_delivery_method
メソッドを削除しています。
Only merge scopes with zero arity in has_many through
activerecord/lib/active_record/associations/through_association.rb
の修正です。
has_many through
を使用していて、かつ、その先のscopeでdynamic conditionsを使用していた場合にエラーになっていたのを対応しています。
has_many :comments, ->(developer) { where(body: "I'm #{developer.name}") } has_many :ratings, through: :comments
上記のようなケースでエラーが発生してしまっていたようです。
Drop schema_migrations table only when exists
activerecord/test/cases/migration_test.rb
の修正です。
テストの最初にdrop_table
でテーブルを削除しているのですが、その際table_exists?('schema_migrations')
でテーブルの存在チェックをし、テーブルがあるときのみ削除するようにしています。
[ci skip] "..enables interrorgating of [thing].." would be correct
activerecord/lib/active_record/reflection.rb
のdocの修正です。
グラマーの修正です。of
を追加しています。
Move as/test_test to as/test_case_test
activesupport/test/test_test.rb
をactivesupport/test/test_case_test.rb
を移動しています。
Add documentation intro to example for Object#itself
.
activesupport/lib/active_support/core_ext/object/itself.rb
のdocの修正です。
Object$itself
のexampleを追加しています。
Updated the deprecation warnings to 5.0
activesupport/lib/active_support/deprecation.rb
の修正です。
Deprecation::initialize
の引数deprecation_horizon
のデフォルト値が'4.2'から'5.0'に変更しています。5.0ですねえ。
Ignore Postgresql "SELECT tablename FROM pg_tables" when counting queries
activerecord/test/cases/test_case.rb
の修正です。
無視するQueryにSELECT tablename FROM pg_tables
を追加しています。
remove end-of-line spacing in development.rb, production.rb
railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
、
railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
の修正です。
末尾の不要なスペースを削除しています。
Clear deliveries in order not to affect other tests
actionmailer/test/message_delivery_test.rb
の修正です。
test_should_enqueue_and_run_correctly_in_activejob
テストでensure処理でActionMailer::Base.deliveries.clear
を行うよう修正しています。
Revert "Do not gsub non ASCII characters in header anchor.".
guideのmakrdownに関するこのコミットをrevertしています。
[ci skip] Format pass of Active Job Basics guide.
rails guideのActive Job Basics
の修正です。
markdownフォーマットの整理をしています。
Fixes the digits counter of AS's NumberToRoundedConverter
activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
の修正です。
digit_count
メソッドで引数のチェックを追加し、0だった場合1を設定するよう対応しています。
- (Math.log10(absolute_number(number)) + 1).floor + number.zero? ? 1 : (Math.log10(absolute_number(number)) + 1).floor
Math.log10(0)
が-Infinityを返してしまうので、zeroの場合1を設定して、 0.0を戻せるようにしたんですねえ。
Deprecated .deliver / .deliver! to .deliver_now / .deliver_now!
actionmailer/lib/action_mailer/message_delivery.rb
の修正です。
deliver
、deliver!
メソッドがdeprecateになっています。Rails 5で削除予定。
今後は、deliver_now!/deliver_later!
、deliver_now/deliver_later
を使用するようにとの事です。
Updated rdoc / guides / release notes related to ActiveJob / ActionMailer
上記deliver``deliver!
メソッドの対応についてdocに追加しています。