diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-18 20:38:46 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-18 20:38:46 +0300 |
commit | 63f11a68c5e9edf36d062bd4f029d81a0861ef82 (patch) | |
tree | 45edeacc3b0e8f102bc43bbc5e693f52b64ce1f9 /app/controllers/dashboard_controller.rb | |
parent | a6070074bc30cf2e6c9eb9b053fc79bdd35d9d6b (diff) |
Fix event loading with associations
Diffstat (limited to 'app/controllers/dashboard_controller.rb')
-rw-r--r-- | app/controllers/dashboard_controller.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index ee9dc343337..eca7b39bcdf 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -22,13 +22,14 @@ class DashboardController < ApplicationController format.html format.json do - @events = Event.in_projects(current_user.authorized_projects.pluck(:id)) - @events = @event_filter.apply_filter(@events).includes(:target, project: :namespace) - @events = @events.limit(20).offset(params[:offset] || 0) + load_events pager_json("events/_events", @events.count) end - format.atom { render layout: false } + format.atom do + load_events + render layout: false + end end end @@ -77,4 +78,10 @@ class DashboardController < ApplicationController def load_projects @projects = current_user.authorized_projects.sorted_by_activity.non_archived end + + def load_events + @events = Event.in_projects(current_user.authorized_projects.pluck(:id)) + @events = @event_filter.apply_filter(@events).with_associations + @events = @events.limit(20).offset(params[:offset] || 0) + end end |