2016/06/22分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Change the raw template handler to render html-safe strings
- A change was made in the helper that renders the
datetime
, being now by defaultdatetime-local
and creating an alias ofdatetime-local
fordatetime
,datetime
tag and it passes to be an abstract class for all other tags that inherit from him.
Add test to better demonstrate ActiveModel::Errors#added?
behavior
activemodel/test/cases/errors_test.rb
の修正です。
ActiveModel::Errors#added?
メソッドが、attributeだけでなくメッセージも一致しないとtrueを返さない事を確認する為のテストを追加しています。
[ci skip] better docs for ActiveRecord::AttributeSet::YAMLEncoder#decode
activerecord/lib/active_record/attribute_set/yaml_encoder.rb
の修正です。
ActiveRecord::AttributeSet::YAMLEncoder#decode
/ ActiveRecord::AttributeSet::YAMLEncoder#decode
メソッドにdocを追加しています。
Change the raw template handler to render html-safe strings
actionview/lib/action_view/template/handlers/raw.rb
の修正です。
raw template handlerがhtml safeなStringを返すよう修正しています。
module Template::Handlers class Raw def call(template) - "#{template.source.inspect};" + "#{template.source.inspect}.html_safe;" end end end
Rails 5からdefault template handlerがERBからrawに変更になっています(Change the default template handler from ERB
to Raw
. · rails/rails@4be859f)。 これはERB template handlerがデフォルトでStringのエスケープを行うようになった為、そのままERB template handlerを使うと生のJS / HTMLが出力される事を期待している既存のアプリが壊れてしまうだろう、ということでraw template handlerに変更になりました。
で、デフォルトで使用されるtemplate handlerが出力する内容がhtml safeで無いのは、それはそれでセキュリティ的に良くないだろう、ということでhtml safeなStringを返すようにしたようです。
Revert "Merge pull request #17973 from maurogeorge/file_field_hidden_field"
file_field
を使用した際、自動でhidden_field
も作成するよう対応した、Merge pull request #17973 from maurogeorge/file_field_hidden_field · rails/rails@c455817をrevertしています。
既存のファイルアップロード処理が壊れてしまう(想定してなかった空文字が来てしまう為)から、とのことです。詳細はissueのコメント参照。
update_url is not get
most of the times [ci skip]
rails guideのA Guide to Testing Rails Applications
の修正です。
Functional Tests for Your Controllers
の項のexampleコードで、更新処理のexampleでget
メソッドを使用していたのをpatch
メソッドに修正しています。普通更新処理にget
は使わないよね、という理由で。
Create times in rails timezone not system timezone [ci skip]
activesupport/lib/active_support/testing/time_helpers.rb
のdocの修正です。
#travel_to
、#travel_back
メソッドのdoc内で、timeクラスを生成するのにTime.new
を使用していたのを、Time.zone.local
を使用するよう修正しています。
Ruby標準のTime.new
を使用すると、システムのタイムゾーンを使用してしまい、exampleとしてはRailsのタイムゾーンを使用するようになっていた方が良いだろう、という理由により。
Change datetime to datetime-local helper tag
actionview/lib/action_view/helpers/form_helper.rb
、
actionview/lib/action_view/helpers/form_tag_helper.rb
の修正です。
datetime_local_field
メソッドをdatetime_field
にリネームし、datetime_field
のaliasとしてdatetime_local_field
メソッドを定義するよう修正しています。この為、datetime_field
、datetime_local_field
どちらを呼び出しても、input[type=datetime-local]
が変えるようになっています。
元々のdatetime_field
メソッドをinput[type=datetime]
を返すようになっていたのですが、input[type=datetime]
はHTML仕様から削除されているので、どちらも同じ値を返すようになっています。また、datetime_field_tag
、datetime_local_field_tag
メソッドについても同様に対応が行われています。