rails commit log流し読み(2014/08/14)
CHANGELOGにのったコミットは以下の通りです。
Add I18n support for input/textarea placeholder text.
Missing ActiveSupport require for calling String#first
actionview/lib/action_view/helpers/translation_helper.rb
の修正です。
require 'active_support/core_ext/string/access'
を追加しています。
[ci skip] add note about the ERB escape in generator docs
rails guideのCreating and Customizing Rails Generators & Templates
の修正です。
ERBについての説明を追加しています。
UnexpectedErrors may reference exceptions that can't be dumped
actionpack/test/abstract_unit.rb
の修正です。
パラレルでテストを行ってエラーが起きた際に、Marshal.dump
でエラーの内容を出力するのですが、そのdumpでエラーが起きた際に、エラーの情報を元にMinitest::UnexpectedError
クラスを作成するよう対応しています。
this should be accessing the hash, not calling a method
actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb
の修正です。
trace
にアクセスする際、メソッド呼び出しではなくhashの値を使用するよう修正しています。
-<%= trace.map(&:trace).join("\n") %> +<%= trace.map { |t| t[:trace] }.join("\n") %>
fewer operations on the options hash
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
Mapping.build
及びMapping#initialize
メソッドにas
引数を追加しています。
options
への参照を減らす為ですかね。
pass consistent parameters to canonical_action?
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
resource_method_scope?
メソッドに引数を追加しています。Hashの参照削減のためかと。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
2回行われていたprefix
のチェックを一度だけ行うよう修正しています。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
prefix_name_for_action
メソッドにscope_level
引数を追加しています。Hashの参照を減らす為。
Finally! None of our tests are order_dependent!
activerecord/test/cases/helper.rb
の修正です。
ActiveSupport::TestCase.my_tests_are_order_dependent!
を削減しています。
これでmy_tests_are_order_dependent!
が全て削除完了のようです。
move scope_level to a method on the scope object
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
Hashのkey(scope_level)を直接参照していたのをメソッドに切り出して、メソッドで確認を行うよう修正しています。
move the scope level key fully inside the scope object
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
こちらも同様。インスタンスを生成する際に、Hashのkeyを直接参照をしていたのをメソッドに切り出しています。
scope_level is no longer a hash key, just use the ivar
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
scope_level
を直接参照している箇所があったのを修正しています。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
scope_level
の呼び出しをメソッドからattr_reader
に修正しています。
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
scope_level
と:resouces
の比較処理をメソッドに切り出しています。
- if @scope.scope_level == :resources + if @scope.resources?
+ def resources? + scope_level == :resources + end
ハードコーディングされているのSymbolを減らす為ですかね。
ask the scope for the action name
actionpack/lib/action_dispatch/routing/mapper.rb
name_for_action
メソッドで行っていたアクション名の取得処理をaction_name
に切り出しています。
ask the scope object if it is a resource_method_scope
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
scope確認用の処理をresource_method_scope?
メソッドに切り出しています。
Merge pull request #16027 from tgxworld/template_assertions
actionpack/lib/action_controller/test_case.rb
の修正です。
assert_template
メソッドの引数にfile: nil
又はfile: false
を指定した場合、ファイルのrenderが無い場合にtrueになるよう修正しています。
Clear validators before and after each test
activerecord/test/cases/validations/i18n_validation_test.rb
、
activerecord/test/cases/validations_repair_helper.rb
の修正です。
setup
でrepair_validations
メソッドを呼び出すよう修正しています。
テストがランダムで実施されるようになった影響で、エラーになってしまったのを対応しています。
因みに、コメントでteardown
でやった方が良くない? という質問が投げられているので、再度修正があるかも。
remove deprecated MissingHelperError
proxy.
actionpack/lib/abstract_controller/helpers.rb
の修正です。
deprecatedだったAbstractController::Helpers::ClassMethods::MissingHelperError
を削除しています。
ಠ_ಠ now that the commit sha is known I can add it to the relese guide.
guides/source/4_2_release_notes.md
の修正です。
上記対応について、4_2_release_notesに対象コミットのリンクを追加しています。
activerecord/test/cases/scoping/relation_scoping_test.rb
の修正です。
クラス名の後ろにスペースを追加しています。
Make sure that fixtures are loaded before finding
activerecord/test/cases/scoping/relation_scoping_test.rb
の修正です。
setupにfixtureの読み込み処理を追加しています。
Merge pull request #8813 from greyblake/dont_write_timestamps_if_they_are_not_attributes
activerecord/lib/active_record/timestamp.rb
の修正です。
timestampsのカラムが無い時、timestampsデータの書き込み処理を行わないよう修正しています。
カラムチェックに誤りがあったらしく、WARNINGが出てしまっていたようです。
因みに、PRが作られたのは"8 Jan 2013"となっているので、また大分古いPRですねえ。
Ignore SCHEMA queries in some habtm tests
activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
の修正です。
幾つかのテストでassert_no_queries
メソッドにignore_none: false
を追加しています。
Fixed AR::Relation#where edge case with Hash and other Relation
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
ActiveRecord::Relation#where
メソッドにHash
または他のRelation
を使用した場合に、動作しなくなっていたのを対応しています。
Author.where(posts: { author_id: Author.where(country_id: 1) }).joins(:posts)
因みに、 ネストは1階層までのみの対応のようです。確かに、そんなに深くまで対応する必要な無さそうですよねえ。
Merge pull request #16438 from agrobbin/input-placeholder-i18n
actionview/lib/action_view/helpers/tags/placeholderable.rb
の修正です。
input/textareaタグのplaceholderにi18nサポートを追加しています。
以下テストコードから一部抜粋。
helpers: { placeholder: { post: { title: "What is this about?", written_on: { spanish: "Escrito en" }, comments: { body: "Write body here" } }, tag: { value: "Tag" } } }
text_field(:post, :body, placeholder: true) # => <input id="post_body" name="post[body]" placeholder="Body" type="text" value="Back to the hill and over it again!" /> whole_form("/posts/123", "create-post", "edit_post", method: "patch") # => <input id="post_comments_attributes_0_body" name="post[comments_attributes][0][body]" placeholder="Write body here" type="text" />
localeファイルのhelpers.placeholder
配下に値を追加すればOKなようです。便利そう。