aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-07-16 21:31:08 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-07-16 21:31:08 +0900
commitd476553d1cdeee0805585c2d4e2e6ee6be841288 (patch)
tree0f358d6cd1d751d676f8513a04e7b53777f080aa /railties/test/commands
parent16f2b2044eaaa54b7bc205ef9af1689a152b2fdf (diff)
downloadrails-d476553d1cdeee0805585c2d4e2e6ee6be841288.tar.gz
rails-d476553d1cdeee0805585c2d4e2e6ee6be841288.tar.bz2
rails-d476553d1cdeee0805585c2d4e2e6ee6be841288.zip
Don't cache `scope_for_create`
I investigated where `scope_for_create` is reused in tests with the following code: ```diff --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -590,6 +590,10 @@ def where_values_hash(relation_table_name = table_name) end def scope_for_create + if defined?(@scope_for_create) && @scope_for_create + puts caller + puts "defined" + end @scope_for_create ||= where_values_hash.merge!(create_with_value.stringify_keys) end ``` It was hit only `test_scope_for_create_is_cached`. This means that `scope_for_create` will not be reused in normal use cases. So we can remove caching `scope_for_create` to respect changing `where_clause` and `create_with_value`.
Diffstat (limited to 'railties/test/commands')
0 files changed, 0 insertions, 0 deletions