なるようになるブログ

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

rails commit log流し読み(2014/06/17)

2014/06/17分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activerecord/CHANGELOG.md


Merge pull request #13963 from lucas-clemente/pending_migrations

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

CheckPendingクラスの引数にconnectionを追加し、adapterがマイグレーションをサポートしていない場合、migration checkをスキップするよう対応しています。


Merge pull request #15684 from aditya-kapoor/add-tests-for-assert-valid-keys

activesupport/test/core_ext/hash_ext_test.rbの修正です。

Hash#asset_valid_keysメソッドのテストケースを追加しています。

Hash#assert_valid_keysメソッド、知らなかったのですが、Hashに引数に指定したkeyの値が無い場合にエラーになるメソッドなんですね。

{ :failore => "stuff", :funny => "business" }.assert_valid_keys([ :failure ])
# ArgumentError: Unknown key: :failore. Valid keys are: :failure

[ci skip] correct doc for serialization in accordance with API Doc Guide

activemodel/lib/active_model/serialization.rbのdocの修正です。

serialization処理に関する説明を修正しています。


Refactor in-place dirty checking to use the attribute object

activerecord/lib/active_record/attribute.rbactiverecord/lib/active_record/attribute_methods/dirty.rbの修正です。

dirtyチェック処理のリファクタリング。共通処理をメソッドに切り出しています。


Add important plugins as one of the tasks of the release

RELEASING_RAILS.rdocの修正です。

release時の作業時に重要なプラグインが動作するか確認する、というのが付け加えられています。追加されたのは以下の2つ。

Rails 5まではサポートする、との事です。


:scissors: and :nail_care: from d60c405 [ci skip]

activemodel/lib/active_model/serialization.rbのdocの修正です。

先ほどコミットされた同ファイルの修正に対して、改行とttタグの追加を行っています。


[ci skip] add API doc for AR Group.

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

groupメソッドの実行例を追加しています。

Article.group(:status, :category).count
# =>  {["draft", "business"]=>10, ["draft", "technology"]=>4,
#          ["published", "business"]=>0, ["published", "technology"]=>2}

[ci skip] /javascript/ ~> JavaScript

actionpack/lib/action_controller/metal/mime_responds.rbのdocの修正です。

コメントの通り、"javascript"を"JavaScript"に修正しています。


Refactor application of type decorators into an object

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

TypeDecoratorクラスを新規に作成して、decoration関連の処理をそちらにまとめています。


Promote time zone aware attributes to a first class type decorator

ActiveRecordのdecorators関連の処理のリファクタリングです。

decorate_matching_attribute_typesメソッドを追加して、decorato処理に条件設定出来るようにした、だと思うのでうが、コミットログのコメントはちょっ違うんだよなあ…。むう。


Formatting fix in AS changelog [ci skip]

activesupport/CHANGELOG.mdの修正です。

"before"を"Before"に、"after"を"After"にそれぞれ修正しています。


[ci skip] doc corrected : ActiveRecord::Base.connections to ActiveRecord::Base.configurations

rails guideのConfiguring Rails Applicationsの修正です。

ActiveRecord::Base.connectionsActiveRecord::Base.configurationsに修正です。多分タイポですね。


fix typo in test method names. [ci skip]

activerecord/test/cases/tasks/database_tasks_test.rbの修正です。

メソッド名をxxx_creates_xxxから、xxx_drops_xxxに修正しています。これもタイポですね。


add bin/rake db:purge task to empty the current database.

activerecord/lib/active_record/railties/databases.rakeと、activerecord/lib/active_record/tasks/database_tasks.rbの修正です

bin/rake db:purgeというtaskを追加しています。DBを空にする為のタスクです。

ConnectionAdapterによって細かな動作は違うのですが、基本的にはDBの再作成を行っているようです。開発時に割と便利。


Move test teardown into ensure block.

activesupport/test/core_ext/kernel/concern_test.rbの修正です。

Object.send :remove_const, :ToplevelConcernensureブロックに移動しています。必ず処理が行われるようにですね。