2014/06/12分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Pluck should work with columns of the same name from different tables
- Fixed automatic maintaining test schema to properly handle sql structure schema format.
Merge pull request #15628 from akshay-vishnoi/test-cases
activesupport/test/core_ext/object/inclusion_test.rb
の修正です。
presence_in
メソッドのテストを追加しています。
activerecord/lib/active_record/reflection.rb
のdocの修正です。
has_one?
メソッドについてdocを追加しています。
Merge pull request #15630 from eileencodes/refactor-join-keys-on-add_constraints
activerecord/lib/active_record/associations/association_scope.rb
とactiverecord/lib/active_record/reflection.rb
の修正です。
associationsのkeyのマージ処理をjoin_keys
に切り出しています。リファクタリング。
Merge pull request #15582 from sgrif/sg-timestamps
activerecord/lib/active_record/timestamp.rb
の修正です。
max_updated_column_timestamp
メソッドをリファクタリングしています。
Move test for blank.rb under object
activesupport/test/core_ext/blank_test.rb
をactivesupport/test/core_ext/object/blank_test.rb
に移動しています。
libの方の構成と合わせた形ですね。
[ci skip] add tests for ActionModel::Conversion
activemodel/test/cases/conversion_test.rb
の修正です。
ActionModel::Conversion
のテストケースを追加しています。"ci skip"となっていますが、テストを追加しています。
No need to require to_param, it is already required in to_query.rb
activesupport/lib/active_support/core_ext/object/conversions.rb
の修正です。
不要なrequire
を削除しています。
[ci skip] correct docs for conversion
activemodel/lib/active_model/conversion.rb
のdocの修正です。
サンプルに間違いがあったらしく、修正しています。
reduce hash lookups and disconnect normalize_port from the options hash
actionpack/lib/action_dispatch/http/url.rb
の修正です。
hashのルックアップ処理を減らしたのと、normalize_port
をoptions
から削除しています。
eliminate nil checks in normalize_port
actionpack/lib/action_dispatch/http/url.rb
の修正です。
normalize_port
メソッドからnilチェックを削除しています。
activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb
の修正です。
不要なrequire 'ipaddr'
を削除しています。
cache protocol on the stack to reduce options hash lookups
actionpack/lib/action_dispatch/http/url.rb
の修正です。
options
に格納されているprotocol
を、別変数に格納するよう修正しています。hashのルックアップを減らす為のようです。
only pull :protocol from the options hash once
actionpack/lib/action_dispatch/http/url.rb
の修正です。
そもそもprotocol
の情報をoptions
に格納しないよう修正しています。
cache host on the stack so we only look it up once
actionpack/lib/action_dispatch/http/url.rb
の修正です。
options
に格納されているhost
を、別変数に格納するよう修正しています。hashのルックアップを減らす為のようです。
actionpack/test/controller/routing_test.rb
とactionpack/test/journey/router_test.rb
の修正です。
使用してない変数がある為、warningsが出ていたので、使用していない変数を削除しています。
remove unnecssary require of to_param
, as to_query
is already require to_param
不要なrequire 'active_support/core_ext/object/to_param'
を削除しています。
Revert "remove unnecssary require of to_param
, as to_query
is already require to_param
"
と思ったら、やっぱり必要だったらしく、先ほどの削除のコミットをrevertしています。
rm same_host?
. The same conditional is two lines down.
actionpack/lib/action_dispatch/http/url.rb
の修正です。
不要なsame_host?
メソッドを削除しています。直ぐ下に同じチェック処理がある為。
Pluck should work with columns of the same name from different tables
activerecord/lib/active_record/relation/calculations.rb
の修正です。
異なるテーブルに同じ名前のカラムがあった場合に、pluck
メソッドが全ての結果が取得出来ていなかったバグを修正しています。
テストケースから抜粋
Topic.joins(:replies).pluck('topics.title', 'replies_topics.title') # [["The First Topic", "The Second Topic of the day"], ["The Third Topic of the day", "The Fourth Topic of the day"]]
join/includesした場合にありえるケースですね。結構便利そうな。
these methods are always called with a tld_parameter
actionpack/lib/action_dispatch/http/url.rb
の修正です。
メソッドの引数にデフォルト引数を設定していたのですが、必ず値が設定される筈、という事で、デフォルト引数を削除しています。
Updating argument names in default matcher for compiling files
rails guideのThe Asset Pipeline
の修正です。
サンプルの変数名がわかりずらかったのを修正しています。
actionpack/lib/action_dispatch/http/url.rb
の修正です。
不要なnilチェックを削除しています。
コミットログに、
irb(main):004:0> /foo/ !~ nil => true irb(main):005:0> /foo/ !~ 'bar' => true irb(main):006:0> /foo/ !~ 'foo' => false
と実行例が書いてあり、大変わかりやすかったです。
There are 3 caveats to Local Precompilation including 1 config change
rails guideのThe Asset Pipeline
の修正です。
Local Precompilation
の項の説明を追加しています。
pull the port out of the options hash once
actionpack/lib/action_dispatch/http/url.rb
の修正です。
options
に格納されているport
を、別変数に格納するよう修正しています。hashのルックアップを減らす為のようです。
scheme should contain one or more characters
actionpack/lib/action_dispatch/http/url.rb
の修正です。
ホスト名の正規表現を修正しています。
- HOST_REGEXP = /(^.*:\/\/)?([^:]+)(?::(\d+$))?/ + HOST_REGEXP = /(^[^:]+:\/\/)?([^:]+)(?::(\d+$))?/
shemeは一文字以上ある筈なので、*
-> +
に修正しています。
only look up the subdomain once
actionpack/lib/action_dispatch/http/url.rb
の修正です。
options
に格納されているsubdomain
を、別変数に格納するよう修正しています。hashのルックアップを減らす為のようです。
actionpack/lib/action_dispatch/http/url.rb
の修正です。
Stringクラスの値に対して、to_param
を呼び出していたらしく、to_param
を削除しています。
remove unnused method from test
railties/test/rails_info_test.rb
の修正です。
使用していないテストを削除しています。
Removed warning actionpack url.rb
actionpack/lib/action_dispatch/http/url.rb
の修正です。
変数名がバッティングしてワーニングが出ていたのを対応しています。
Add unregister_template_handler to prevent leaks.
actionview/lib/action_view/template/handlers.rb
の修正です。
ActionView::Template::Handler.unregister_template_handler
を追加しています。名前の通り、ActionView::Template::Handler.register_template_handler
で登録したhandlerを登録解除するためのメソッドです。
Fixed automatic maintaining test schema to properly handle sql structure schema format.
activerecord/lib/active_record/tasks/database_tasks.rb
の修正です。
load_schema
メソッドを実行する際、purge
メソッドを呼び出すよう修正しています。
purge
メソッドではDBのdrop/createを行っています。なので、schema.rb
を読むタスクでは、必ずDBの再作成が行われるようになります。なので、"automatic maintaining"何ですね。