https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292016-01-10T03:13:51ZRedmineRedmine - Patch #21582: Performance in User#roles_for_projecthttps://www.redmine.org/issues/21582?journal_id=684162016-01-10T03:13:51ZGo MAEDA
<ul><li><strong>Target version</strong> set to <i>3.3.0</i></li></ul><p>I think we can remove the last 'dup' method from Ondřej Ezr's patch because ActiveRecord::Associations::CollectionProxy#to_a returns copied objects.</p>
<pre><code class="ruby syntaxhl"><span class="c1"># File activerecord/lib/active_record/associations/collection_proxy.rb, line 943</span>
<span class="k">def</span> <span class="nf">to_ary</span>
<span class="n">load_target</span><span class="p">.</span><span class="nf">dup</span>
<span class="k">end</span>
</code></pre> Redmine - Patch #21582: Performance in User#roles_for_projecthttps://www.redmine.org/issues/21582?journal_id=684252016-01-10T11:37:26ZOndřej Ezr
<ul></ul><p>true, I just put to_a there with heureka feeling, but you are right dup is meaningless now :)</p> Redmine - Patch #21582: Performance in User#roles_for_projecthttps://www.redmine.org/issues/21582?journal_id=684292016-01-10T16:01:05ZGo MAEDA
<ul></ul><p>Thanks for your feedback. Nice eureka!</p> Redmine - Patch #21582: Performance in User#roles_for_projecthttps://www.redmine.org/issues/21582?journal_id=686142016-01-16T07:50:34ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Subject</strong> changed from <i>Performance in roles</i> to <i>Performance in User#roles_for_project</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li></ul><p>Committed, thanks.</p>