Vote #77043
完了Performance in User#roles_for_project
0%
説明
roles are duplicating a scope not an result, thus every hit produce a query, cached, but it is still not desired.
journals
I think we can remove the last 'dup' method from Ondřej Ezr's patch because ActiveRecord::Associations::CollectionProxy#to_a returns copied objects.
<pre><code class="ruby">
# File activerecord/lib/active_record/associations/collection_proxy.rb, line 943
def to_ary
load_target.dup
end
</code></pre>
--------------------------------------------------------------------------------
true, I just put to_a there with heureka feeling, but you are right dup is meaningless now :)
--------------------------------------------------------------------------------
Thanks for your feedback. Nice eureka!
--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------