2014/05/21分のコミットです。
CHANGELOGにのったコミットは以下の通りです(詳細は本文参照)。
- Prevented belongs_to: touch propagating up if there are no changes being saved
- Changed scoped blocks to be executed with
instance_eval
- Fixed polymorphic eager loading when using a String as foreign key.
Fix confusing exception in ActiveSupport delegation
Module::NoMethodError::DelegationError#delegate
メソッドの修正です。
delegate先のメソッドでエラーが起きた際に、エラーの内容がおかしい事があったのを修正しています。
class A delegate :even?, to: :whatever def whatever "arbitrary_object".even? 123 end end # before # Module::DelegationError: A#even? delegated to whatever.even?, but whatever is nil: #<A:0x007fc6aea2d768> # after # NoMethodError: undefined method `even?' for "arbitrary_object":String
Delegate type_cast to injected type object in mysql
MySQLのDBAdapterの修正です。
type objectにTimeValue
を追加し、time型の場合そちらを使用するようにしています。
Have Postgres OID types inherit from general types
PostgresのDBAdapterの修正です。
OID型についても、通常のtype valueオブジェクトを使用するように修正しています。
Use general types for mysql fields
MySQLのDBAdapterの修正です。
fieldについても、通常のtype objectを使うよう修正しています。
Replace type_cast
case statement with delegation
DBAdapterの修正です。
各adaperで行っていたtype_cast
処理をtype objectのに移譲しています。
fix multiple hash preloads. Fixes #14994
ActiveRecord::Associations::Preloader#preloaders_for_hash
メソッドの修正です。
複数のHashを引数にしてpreload
メソッドを呼び出した際に、loadされないバグがあったのを修正しています。
make the each visitor top-down left-right
ActionDispatch::Journey::Visitors::Visitor#visit
メソッドの修正です。
super
メソッドの呼び出し順序を変更しているのは解るのですが、どのような意図の修正かが解らない…。
prepopulate the dispatch cache so we don't need the ThreadSafe cache.
actionpack/lib/action_dispatch/journey/visitors.rb
の修正です。
ThreadSafe::Cache
を削除しています。
Use the generic type map object for mysql field lookups
MySQLのDBAdapterの修正です。
type判定用にHashLookupTypeMap
クラスを新規に作成し、そちらのクラスを使用するよう修正しています。
translate AST to a formatter before url generation
actionpack/lib/action_dispatch/journey/route.rb
の修正です。
url生成前に、ASTの解析処理を実施するよう修正しています。
cache the formatter on the path object
ActionDispatch::Journey::Path::Pattern
クラスの修正です。
Pattern
クラスにpath objectのformat情報を保持するよう修正しています。
actionpack/lib/action_dispatch/journey/visitors.rb
の修正です。
使用しなくなったコードを削除しています。
Delegate predicate methods to injected type object on Column
DBAdapterの修正です。
text?
, number?
, binary?
メソッドをcast_type
にdelegateするよう修正しています。
Use the generic type map for PostgreSQL OID registrations
PostgreSQLのDBAdapterの修正です。
OIDについてもHashLookupTypeMap
を使用するよう修正しています。
Inline typecasting helpers from Column to the appropriate types
DBAdapterの修正です。
activerecord/lib/active_record/connection_adapters/column.rb
で行っていた型キャストの処理を、各type objectに移動しています。
Merge pull request #11346 from tomykaira/fix_10257
actionpack/lib/action_controller/metal/http_authentication.rb
の修正です。
Basic認証のチェック処理で、'Basic'以外のスキームでも認証処理が通ってしまっていたバグを修正しています。
Delegate type_cast_for_write
to injected type object
DBAdapterの修正です。
type_cast_for_write
をcast_type
にdelegateするよう修正しています。
fix variable names, only pass hashes to the positional args method
actionpack/lib/action_dispatch/routing/route_set.rb
の修正です。
変数名の修正。
fewer hash allocations when calling url_for
ActionDispatch::Routing::UrlFor#url_for
メソッドの修正です。
Hashの生成処理を少し減らしていいます。
fewer method calls and string garbage when there is no user/password
ActionDispatch::Http::URL#build_host_url
メソッドの修正です。
オプションにuser/passwordが設定されてない場合に、不要なString生成処理を減らしています。
ActionDispatch::Routing::UrlFor#url_for
メソッドの修正です。
引数のチェック処理をメソッドの最初で行うよう修正しています。
actionpack/lib/action_dispatch/http/url.rb
の修正です。
こちらも引数のチェック処理の順序の修正しています。
mutate the path string to avoid object allocations
ActionDispatch::Routing::UrlFor#url_for
メソッドの修正です。
sub
ではなく、sub!
を使うようにして、不要な変数生成処理を削除しています。
fewer string allocations per url_for
ActionDispatch::Routing::UrlFor#url_for
メソッドの修正です。
処理の順番修正し、String生成処理を減らしています。
we don't use this parameter for anything, so rm
ActionDispatch::Journey::Formattr##generate
メソッドの修正です。
使用していない変数の削除。
Merge pull request #15154 from msgehard/move_password_field
activemodel/lib/active_model/secure_password.rb
の修正です。
attr_reader :password
を宣言している箇所を修正しています。
Prevented belongs_to: touch propagating up if there are no changes being saved
belongs_to: touch
を使用している際、値が更新された場合のみ、touch
処理が行われるよう修正しています。
Delegate klass
to the injected type object
DBAdapterの修正です。
klass
をcast_type
にdelegateするよう修正しています。
Revert "Revert "Merge pull request #8313 from alan/only_save_changed_has_one_objects""
こちらのPRのrevertをrevertしています。ややこしい。
has_one associationsを使用している時に、子のオブジェクトの値が変わったときのみ、save処理を行うよう修正しています。
issueはこちら。ちょっとややこしいので、後でもうちゃんと読もう。
Merge pull request #14544 from jefflai2/named_scope_sti
scoped blocksをinstance_eval
で実行するよう修正しています。
ActiveRecord::Base
を継承したclassを更に継承したクラスでscope blocksを使用していた場合に、生成させるクエリーがおかしくなる場合があったようです。
issueから
class User < ActiveRecord::Base belongs_to :role end class Term < ActiveRecord::Base end class Role < Term end class ProductCategory < Term belongs_to :realm, class_name: 'Role' scope :view_as_realm, -> { where realm: user.role } end
SELECT `terms`.* FROM `terms` WHERE `terms`.`type` IN ('ProductCategory') AND `terms`.`type` IN ('Role') AND `terms`.`id` = 193 ORDER BY `terms`.`id` ASC LIMIT 1
何故かクエリーにクラス名が。
なお、4.0.0 - 4.0.2の間で壊れてしまったようです。
Merge pull request #10887 from sakuro/deep_transform_keys_in_nested_arrays
Hash#deep_transform_keys
と Hash#deep_transform_keys!
がネストしたArrayも引数にとれるように修正しています。
使えそうなケースがありそうですが、忘れそう…。
actionpack/lib/action_dispatch/middleware/public_exceptions.rb
の修正です。
不要な判定処理を削除しています。
Fix polymorphic eager load with foreign_key as String.
polymorphic
を使用している、かつ、外部keyにStringを使用している場合に、eager loadingをするとエラーになるバグを修正しています。
これ割と問題になるケースが多そうな。polymorphic
があまり使われてないからですかねえ。
pg, extract money tests into separate file.
PostgreSQLのDBAdapterのテストの修正です。
activerecord/test/cases/adapters/postgresql/money_test.rb
を新規に作成して、money
関連のテストはそこに集約しています。
push extract_scale
to the Type
.
activerecord/lib/active_record/connection_adapters/column.rb
の修正です。
extract_scale
のdelegate先をcast_type
メソッドに修正しています。
build fix, use lambda syntax that ruby 1.9.3 understands.
activerecord/test/models/comment.rb
の修正です。
lambdaを使用している箇所で、スペースを削除。
- scope :special_parent, -> (special_rating) { where parent_id: special_rating.special_comment.id } + scope :special_parent, ->(special_rating) { where parent_id: special_rating.special_comment.id }
fix formatting and text for ActionController::Redirecting doc
ActionController::Redirecting
のdocの修正です。
引数の説明が誤っていたのを修正しています。