fix projects sorting; fix Postgresql issue with LIMIT and DISTINCT; fix query performance
This commit is contained in:
parent
b339c747a9
commit
31bf0cd876
3 changed files with 4 additions and 4 deletions
|
@ -67,7 +67,7 @@ module Account
|
|||
events = events.recent.limit(1).first
|
||||
end
|
||||
|
||||
def projects_with_events
|
||||
projects.includes(:events).order("events.created_at DESC")
|
||||
def projects_sorted_by_activity
|
||||
projects.order("(SELECT max(events.created_at) FROM events WHERE events.project_id = projects.id) DESC")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue