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を実行して値を取得していた)。