2016/12/09分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Fix
read_attribute
method to check whether an attribute is aliased or not, and use the aliased attribute name if needed. - Fix
write_attribute
method 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
を削除しています。