Sort suggestions by speaker name

This commit is contained in:
Petko Bordjukov 2014-10-10 19:23:38 +03:00
parent 0efe4b95cb
commit 054ef9c947
2 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,7 @@ class SuggestionGroup
def self.where(conditions = {})
Event.joins(:track).includes(:user).where(conditions).group_by(&:user).map do |speaker, suggestions|
SuggestionGroup.new speaker: speaker, suggestions: suggestions
end
end.sort_by { |group| group.speaker.name }
end
def self.for_conference(conference, conditions = {})

View File

@ -13,6 +13,10 @@ class User < ActiveRecord::Base
default_scope { order id: :desc }
def name
speaker_profile.try(:name) || email
end
def toggle_admin!
update admin: !admin
end