]> source.dussan.org Git - redmine.git/commitdiff
Use pluck instead of map in MyHelper (#26711).
authorGo MAEDA <maeda@farend.jp>
Sun, 26 Nov 2017 14:37:31 +0000 (14:37 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 26 Nov 2017 14:37:31 +0000 (14:37 +0000)
Patch by jwjw yy.

git-svn-id: http://svn.redmine.org/redmine/trunk@17036 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/my_helper.rb

index 6c61de894f702c0a639726c8c8df0215c7d64d01..9acc9e644d562209cdd8ad7cc92f5568d141a2f5 100644 (file)
@@ -78,7 +78,7 @@ module MyHelper
   def render_calendar_block(block, settings)
     calendar = Redmine::Helpers::Calendar.new(User.current.today, current_language, :week)
     calendar.events = Issue.visible.
-      where(:project_id => User.current.projects.map(&:id)).
+      where(:project_id => User.current.projects.pluck(:id)).
       where("(start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)", calendar.startdt, calendar.enddt, calendar.startdt, calendar.enddt).
       includes(:project, :tracker, :priority, :assigned_to).
       references(:project, :tracker, :priority, :assigned_to).
@@ -139,7 +139,7 @@ module MyHelper
 
   def render_news_block(block, settings)
     news = News.visible.
-      where(:project_id => User.current.projects.map(&:id)).
+      where(:project_id => User.current.projects.pluck(:id)).
       limit(10).
       includes(:project, :author).
       references(:project, :author).