2016/09/01分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Merge pull request #26226 from schneems/schneems/explicit-public-urls
Action View、raitiesの修正です。
各view用のhelper method(image_tag
やjavascript_include_tag
等)に、asset pipelineを使用しているかどうかを明示的に指定するためのオプション(skip_pipeline
)を追加しています。
skip_pipeline
にtrueを指定した場合、digestやassets
pathがつかないpathが生成されます。
asset_path("application.js") # => "/assets/application-85e543ffb6766161629d4b7a5dd540252230a0f0e5287de6701be45c52d107de.js" asset_path("application.js", skip_pipeline: true) # => "/application.js"
また、合わせて、helper methodに存在しないファイルを指定した場合にexceptionをraiseするかどうかの設定(config.assets.unknown_asset_fallback
)を追加しています。新規に作成するrailsアプリではfalse
(exceptionをraiseする)になっています。既存の挙動(exceptionをraiseしない)にしたい場合は、true
を指定すればOKです。
sprockets-rails側の対応はこちら。Deprecate asset fallback by schneems · Pull Request #375 · rails/sprockets-rails。
Override respond_to_missing?
instead of respond_to?
when possible
Action Pack、Active Recordの修正です。
各classやmoduleでrespond_to?
をoverrideしていたのを、respond_to_missing?
をoverrideするよう修正しています。該当の処理ではmethod_missing
に反応させたいだけであり、respond_to_missing?
の方が意図として適切だから、という理由のようです。
Attempt to maintain encoding for arrays of strings with PG
activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb
の修正です。
PostgreSQLでStringのarrayを使用しているかつ、non asciiの値がStringに含まれていた場合に、serialize / deserialize処理で文字化け(encodingがおかしくなってしまう)てしまうバグがあったのを修正しています。
Rails 5.0.0からarrayに関する処理はpg
gemで行うようになったのですが、pg
gemのarrayの処理ではencodingに関する処理は行わないようになっている為問題が発生してしまっていました。Active Record側でencodingの設定処理を行うように対応しています。
Revert "Extract PredicateBuilder::CaseSensitiveHandler
"
ActiveRecord::Validations::UniquenessValidator#build_relation
メソッド内でやっていたArel ASTの生成処理を別クラス(ActiveRecord::PredicateBuilder::CaseSensitiveHandler
)に切り出した、Extract `PredicateBuilder::CaseSensitiveHandler`をrevertしています。
predicate builderでArel ASTの生成をやる方向は良くないのでは、という事でrevertされたようです。ムズい。
Remove deprecated handling of PG Points
Active Recordの修正です。
Rails 5.0.0でdepcateになっていた、PostgreSQLのpoint
型を使用した場合にattributeがArray
objectになる挙動を削除しています。今後はPoint
objectになります。
Include user defined attributes in inspect
activerecord/lib/active_record/core.rb
の修正です。
ActiveRecord::Core#inspect
で表示対象のattributeを取得するのにcolumn_names
を使用していたのを、attribute_names
を使用するよう修正しています。ユーザが独自に定義したattributeも表示されるようにするため。
guides/source/credits.html.erb
の修正です。
Jason Zimdars氏のtwitterアカウントへのリンクを修正しています。
Merge pull request #26328 from kirs/strong-params-to-param
actionpack/lib/action_controller/metal/strong_parameters.rb
の修正です。
ActionController::Parameters#to_param
メソッドをActionController::Parameters
のdeprecatedメソッドの一覧に追加しています。
Rail 4系まではActionController::Parameters#to_param
メソッドはそのままURIに使える値(ex: return_url=foo&result_id=bar
)を返していたのですが、Rails 5ではそれが出来ないようになっており、かつ今後もサポートはしな予定なので、deprecated対象に追加したとの事です。
Move to_param undef closer to the deprecations.
actionpack/lib/action_controller/metal/strong_parameters.rb
の修正です。
先のActionController::Parameters
で行ったto_param
をundefにする対応を、他のdeprecationsに関する対応の近くで行うよう処理の位置を修正しています。
Add changelog entry for #26328.
actionpack/CHANGELOG.md
の修正です。
先のActionController::Parameters#to_param
の対応について、CHANGELOGにエントリーを追記しています。
Merge pull request #25758 from vipulnsward/fix-key-len-issue
actionpack/lib/action_dispatch/middleware/cookies.rb
、
activesupport/lib/active_support/message_encryptor.rb
の修正です。
ActionDispatch::Cookies::EncryptedCookieJar#initialize
でkeyを生成する際に、適切なkeyの長さに合わせて値を調整するよう修正しています。
- secret = key_generator.generate_key(request.encrypted_cookie_salt || "") + secret = key_generator.generate_key(request.encrypted_cookie_salt || "")[0, ActiveSupport::MessageEncryptor.key_len]
Ruby 2.4ではkey sizeを厳密に見るようになり、必要なkey sizeより大きい値を指定するとエラーになるようになった為、適切なsizeになるよう対応しています。
参考:openssl: make Cipher#key= and #iv= reject too long values · ruby/ruby@ce63526
actionview/lib/action_view/helpers/asset_tag_helper.rb
の修正です。
video_tag
メソッドでRubyのwarning(warning: shadowing outer local variable - options
)が出るようになってしまっていたので、重複していた変数名を修正し対応しています。
actionview/lib/action_view/helpers/form_helper.rb
のdocの修正です。
radio_button
メソッドのdoc内のexampleに説明を追加しています。
Cache to_datetime for performance
activesupport/lib/active_support/time_with_zone.rb
の修正です。
ActiveSupport::TimeWithZone#to_datetime
メソッドで値をキャッシュするよう修正しています。
def to_datetime - utc.to_datetime.new_offset(Rational(utc_offset, 86_400)) + @to_datetime ||= utc.to_datetime.new_offset(Rational(utc_offset, 86_400)) end
性能改善の為。