2016/12/09分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Fix
read_attributemethod to check whether an attribute is aliased or not, and use the aliased attribute name if needed. - Fix
write_attributemethod to check whether an attribute is aliased or not, and use the aliased attribute name if needed. - Moved DecimalWithoutScale, Text, and UnsignedInteger from Active Model to Active Record
activemodel/CHANGELOG.md
Merge pull request #27185 from kamipo/fix_apply_seconds_precision
activemodel/lib/active_model/type/helpers/time_value.rbの修正です。
ActiveModel::Type::Helpers::TimeValue#apply_seconds_precisionがmathnをrequireしている場合に正しい値を返さないバグがあったのを修正しています。
- value.change(usec: value.usec / round_power * round_power) + value.change(usec: value.usec - value.usec % round_power)
mathnをrequireした場合、除算が正確な値を返すようになり、requireしてない場合と結果が変わってしまい、正しくusecのroundが出来てなかった為。
irb(main):002:0> 1234 / 1000 # => 1 irb(main):003:0> require 'mathn' irb(main):004:0> 1234 / 1000 # => (617/500)
なるほどー。
Add some documentation around internal APIs [ci skip]
activerecord/lib/active_record/attribute_decorators.rbのdocの修正です。
ActiveRecord::AttributeDecorators#decorate_attribute_type、#decorate_matching_attribute_typesメソッドにdocを追加しています。
Merge pull request #27278 from kamipo/should_be_sync_primary_key_definition
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rbの修正です。
primary_keyの値をBIGINT(8) UNSIGNED auto_increment PRIMARY KEYからbigint auto_increment PRIMARY KEYに修正しています。実際使用される型に合わせる為、との事です。
Check whether the current attribute being read is aliased or not before reading
activerecord/lib/active_record/attribute_methods/read.rbの修正です。
read_attributeメソッドにalias_attributeで定義されたattributeを指定した場合に、値が取得出来ないバグがあったのを修正しています。
Check whether the current attribute being write is aliased or not before writing
activerecord/lib/active_record/attribute_methods/write.rbの修正です。
write_attributeメソッドにalias_attributeで定義されたattributeを指定した場合に、値が設定出来ないバグがあったのを修正しています。
Make Yarn the default, drop default vendor/asset directories (#27300)
railtiesの修正です。
先日追加されたyarnの対応がデフォルトtrueになりました。yarnを使いたく無い場合は、rails newする際に明示的に--skip-yarnを指定する必要があります。
また、合わせて、vendor/assetsディレクトリが生成されなくなりました。これはassetsの管理はyarn経由で行う事が推奨されるようになり、不要になった為、
Merge pull request #26696 from iainbeeston/only-ruby-types-in-activemodel
Active Record、Active Modelの修正です。
ActiveModel::Typeで定義されているtype classのうち、DecimalWithoutScale、Text、UnsignedInteger typeをActive ModelからActive Recordに移動しています。これらのtypeはSQL用のtypeであり、pure Rubyには不要である為、Actve Record配下に移動したとの事です。
Merge pull request #25051 from bf4/extract_notes_as_binary
railties/lib/rails/source_annotation_extractor.rbの修正です。
rails notes taskでファイルを読み込む際、encodingにEncoding::BINARYを指定するよう修正しています。UTF-8として読み込みでしまうとエラーになってしまうケースがある為。
Fix test breaking error uninitialized constant ActiveRecord::Type::Value.
activerecord/lib/active_record/type.rbの修正です。
先のtype classの移動対応で誤ってValue classのaliasが削除されてしまっていたのを戻しています。
Make ActiveModel::Errors backward compatible with 4.2
activemodel/lib/active_model/errors.rbの修正です。
Rails 4.2で作られたActiveModel::ErrorsクラスのオブジェクトをyamlにしたファイルがRails 5.0で読み込めなかったのを対応しています。
@detailsインスタンス変数が無かったのが問題だった為、init_withメソッドを追加し、そこで@details変数の初期化処理を行うよう修正しています。
Resolve association class correctly when assigning ids on a through association
activerecord/lib/active_record/associations/collection_association.rb、
activerecord/lib/active_record/reflection.rbの修正です。
association経由でidsを設定する際に、association classを正しく解決出来ない事があるバグがあったのを修正しています。
Merge pull request #27303 from toshimaru/fix/partial-variable-block
actionview/lib/action_view/template.rb、
activesupport/lib/active_support/core_ext/module/delegation.rbの修正です
元々はviewでblockという名前の変数が使えていたのが、Rails 5.0.1.rc1で使えなくなっていたのを、再度使用出来るよう修正しています。
specify skip_yarn option in API-only Application (#27309)
railties/lib/rails/generators/rails/app/app_generator.rbの修正です。
api only appの場合yarn用のファイル、設定を追加しないよう修正しています。
railties/test/generators/app_generator_test.rbの修正です。
先にコミットされたyarnをデフォルトtrueにする対応で既存のテストが壊れてしまっていたのを修正しています。
Fix ability to run railties test suite
railties/Rakefileの修正です。
test::isolated taskでデフォルトでincludeするlibにactivemodel/libを追加しています。
Only have Yarn bundling commented out as we cant be sure Yarn is installed
railties/lib/rails/generators/rails/app/templates/bin/setup.ttの修正です。
bin/yarnの実行をコメントアウトしています。yarnがインストールされてない可能性もあるので、コメントアウトにしたとの事です。
remove deprecated assert_send from assertion list [ci skip]
rails guideのA Guide to Testing Rails Applicationsの修正です。
Available Assertionsの項から、minitest 5.10.0でdeprecatedになったassert_sendを削除しています。