2016/07/28分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Remove circular join references in join_dependency
activerecord/lib/active_record/associations/join_dependency/join_association.rbの修正です。
associationのjoin + current_scopeメソッドを一緒に使用した場合に、無限ループが発生してしまい、SystemStackErrorでエラーになってしまうバグがあったのを修正しています。
Merge pull request #25938 from kamipo/decouple_statement_cache_from_connection_adapter
activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb、
activerecord/lib/active_record/statement_cache.rbの修正です。
cacheable_queryメソッドで直接Statement Cacheを参照していたのを、引数のklass経由から参照するよう修正しています。
Gemfile.lockの修正です。
使用するarelのバージョンを7.1.1に更新しています。
7.1.0でCasted#hashがエラーになってしまうバグがあり、7.1.1でその対応が行われた為、更新したようです。参考:Fix Casted#hash · rails/arel@f91d657
Generators and tests are under the same style rules
.codeclimate.ymlの修正です。
各generatorsのコード及びテストがexclude_pathsに含まれていたのを、codeclimateの対象となるようexclude_pathsから削除しています。
Merge pull request #25913 from chrisarcand/fix-keyed-defaults-with-root
actionpack/lib/action_dispatch/routing/mapper.rbの修正です。
routesのrootメソッドにdefaultsオプションを指定した場合に、defaultsオプションに指定した値が使用されないバグがあったのを修正しています。
Merge pull request #25963 from bdewater/auth_tag_doc
activesupport/lib/active_support/message_encryptor.rbのdocの修正です。
ActiveSupport::MessageEncryptor#_decryptメソッド内で、auth_tagをチェックしているロジックに何故チェックしているのかのコメント、及び参考URL(Authenticated Encryption should check for tag length · Issue #63 · ruby/openssl)のリンクを追加しています。
Add the TABLE_SCHEMA condition to the SELECT statement in table_comment (#25945)
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rbの修正です。
MySQLでtable commentを取得する際、table_schemaを指定するよう修正しています。
select_value(<<-SQL.strip_heredoc, 'SCHEMA')
SELECT table_comment
FROM information_schema.tables
- WHERE table_name=#{quote(table_name)}
+ WHERE table_schema=#{quote(current_database)}
+ AND table_name=#{quote(table_name)}
SQL
使用しているschemaからのみ値を取得する為。
Merge pull request #25767 from kamipo/association_name_is_the_same_as_join_table_name
activerecord/lib/active_record/table_metadata.rbの修正です。
has_and_belongs_to_manyを使用している、かつ、join_tableオプションに指定するテーブル名とassociation名が同じだった場合に、ActiveRecord::TableMetadata#associated_tableがエラーになってしまうバグがあったのを修正しています。
Use a form of rb-inotify to fix broken tests with Ruby 2.2.5
Gemfileの修正です。
forkしたrb-inotifyを使用するよう修正しています。現状のrb-inotifyはRuby 2.2.5でエラーになってしまう問題がある為との事です。 参考:Ensure the IO always gets closed, exactly once by matthewd · Pull Request #49 · nex3/rb-inotify
Gemfileの修正です。
rb-inotifyをrequireしないようrequire: falseオプションを追加しています。
Merge pull request #25952 from harfangk/master
rails guideのGetting Started with Railsの修正です。
Getting Up and Runningの項、ActionController::UnknownFormatが発生した場合の説明について更新しています。
Rails 5でrender処理に変更が入ったのですが、説明が古い挙動のままになっていた為、最新の内容に更新しています。
Merge pull request #25961 from Azzurrio/master
activejob/lib/active_job/core.rb、
activejob/lib/active_job/queue_adapters/sidekiq_adapter.rbの修正です。
sidekiq adapterを使用している場合に、job内部でprovider_job_idを参照すると、正しい値が返ってこない(必ずnilがかえる)バグがあったのを修正しています。
Merge pull request #25948 from chetna1726/docs
rails guideのActive Record Query Interfaceの修正です。
Orderingの項に、MySQL 5.7.5 以上を使っている場合にorderに入れているカラムをselectに含めない場合に、ActiveRecord::StatementInvalidが発生する場合がある旨説明を追加しています。
MySQL 5.7はデフォルトでONLY_FULL_GROUP_BYが有効になっており、ONLY_FULL_GROUP_BYが有効の場合はORDER BY句のカラムはDISTINCTのカラムリストに入れる必要がある為、ですかねえ。
@quoted_{column,table}_names should cache a frozen string
Active Recordの修正です。
#quote_column_name、#quote_table_nameがfreezeした値を返すよう修正しています。
freezeしておかないと、値を上書き出来てしまう為、それを避ける為にとの事です。
Avoid calling current_database in table_comment
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rbの修正です。
table_commentメソッドでschemaを取得するのに、current_databaseメソッドを使用していたのを、extract_schema_qualified_nameメソッドを使用して、引数のtable_nameからschemaを取得するよう修正しています。
current_databaseメソッドを使用するとqueryが実行されてしまう為、余計なqueryが実行されるのを避ける為にextract_schema_qualified_nameメソッドを使用するように修正したとの事です。
Merge pull request #25340 from kamipo/prevent_table_comment_query
Active Recordの修正です。
schemaをdumpする際、 tableのcommentが存在しない場合は、table_comment queryが発行されないよう修正しています。
Merge pull request #25937 from kamipo/remove_prepare_binds_for_database
Active Recordの修正です。
bind処理の為のprepare_binds_for_databaseメソッドを削除し、呼び出していた各所で自前でbind処理を行うよう修正しています。
prepare_binds_for_databaseメソッドはconnection adapterに定義されていたのですが、bind処理を行うのにconnection adapterに依存するのを止める為、削除したようです。
Merge pull request #25940 from kamipo/fix_collection_proxy_load
activerecord/lib/active_record/associations/collection_proxy.rbの修正です。
ActiveRecord::Associations::CollectionProxyクラスにexec_queriesメソッドを追加しています。
associationのloadメソッドを使用した場合、内部的にはexec_queriesメソッドが呼ばれるようになっている(https://github.com/rails/rails/blob/master/activerecord/lib/active_record/relation.rb#L573)為、associationのreloadが正しく行われるようにするために、exec_queriesメソッドを追加したようです。
Merge pull request #25941 from kamipo/finder_methods_uses_load_target
activerecord/lib/active_record/associations/collection_proxy.rb、
activerecord/lib/active_record/relation/finder_methods.rbの修正です。
FinderMethodsで、recordがload済みの場合、そのload済みの値を使用するよう修正しています(元々はload済みでは再度queryを実行して値を取得していた)。