なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2017/06/27)

2017/06/27分のコミットです。

CHANGELOGへの追加はありませんでした。


Merge pull request #29519 from Edouard-chin/ec-structure-flags-order

activerecord/lib/active_record/tasks/mysql_database_tasks.rbの修正です。

MySQLのdump / load処理で、structure_dump_flags / structure_load_flagsに指定したオプションを最初にコマンドに渡すよう修正しています。

mysqlではオプションを渡す順番に意味があり、たとえば--no-defaultsのようなオプションは他のオプションより先に渡す必要がある為との事です。

参考:MySQL :: MySQL 5.7 Reference Manual :: 4.2.7 Command-Line Options that Affect Option-File Handling


Merge pull request #29511 from jhawthorn/clear_offsets_cache_on_collection_proxy

activerecord/lib/active_record/associations/collection_proxy.rbの修正です。

CollectionProxy#reset / CollectionProxy#reloadfind_nthで取得したレコードのキャッシュをクリアーするよう修正しています。


Update security.md

rails guideのRuby on Rails Security Guideの修正です。

Brakeman - Rails Security Scannerへのリンクの後にスペースを追加しています。


Merge pull request #29560 from fatkodima/remove_unnecessary_tap_call

railties/lib/rails/application/default_middleware_stack.rbの修正です。

DefaultMiddlewareStack#build_stackActionDispatch::MiddlewareStackをnewした結果をtapしていたのを、tapを削除しています。

ActionDispatch::MiddlewareStack#initializeの中でblockのyields処理が行われており、tapする必要は無い為。


Merge pull request #29568 from kamipo/ensure_using_correct_alias_tracker

Active Recordの修正です。

Associations::AliasTrackerクラスでtype casterに誤ったクラスが指定されてしまうバグがあったのを修正しています。


Merge pull request #29557 from kamipo/extract_build_scope_and_predicate_builder

Active Recordの修正です。

build_scope及びpredicate_builderReflectionmoduleに切り出しています。


Merge pull request #29571 from kamipo/fix_extracting_references_via_order_values

activerecord/lib/active_record/relation/query_methods.rbの修正です。

WhereChain#preprocess_order_argsメソッドでreferencesを取得する際に、テーブル名をquoteしている場合に、テーブル名が正しく取得出来ないバグがあったのを修正しています。


Ignore public/assets

railties/lib/rails/generators/rails/app/templates/gitignoreの修正です。

デフォルトで生成されるgitignoreに/public/assetsを追加しています。

assets precompileでのファイル生成は各環境で行うべきであり、バージョン管理に追加すべきではない為。そういえば何で今までで追加されてなかったんだろう。


ActiveJob::Core#serialize stores provider_job_id (fixes #26581).

activejob/lib/active_job/core.rbの修正です。

ActiveJob::Core#serializeメソッドでprovider_job_idを含むよう修正しています。

serialize対象に入っていないと、after_enqueuebefore_perform等のcallbackで値が取得出来ない為。


Document ActiveRecord’s PostgreSQL-specific support for JSONB datatype in RailsGuides

rails guideのActive Record and PostgreSQLの修正です。

JSONの項をJSON and JSONBに修正し、jsonbを使用した場合のexampleを追加しています。


Skip instantiating NullPreloader if assoc.klass is nil

activerecord/lib/active_record/associations/preloader.rbの修正です。

assoc.klassnilの場合に、不要なNullPreloaderインスタンス生成処理を行わないよう修正しています。


Move constructing polymorphic type to join_scope in Reflection

Active Recordの修正です。

JoinAssociation#join_constraintsで行っていた polymorphic typeの生成処理を、Reflection moduleのjoin_scopeメソッドで行うようリファクタリングしています。


Move building constraint to join_scope in Reflection

Active Recordの修正です。

JoinAssociation#join_constraintsで行っていたconstraintの生成処理を、Reflection moduleのjoin_scopeメソッドで行うようリファクタリングしています。