keynote type available only to admins. Able to mark as highlight. Highlights and Keynotes scoped.

This commit is contained in:
Stella Rouzi 2014-11-28 14:47:39 +02:00
parent 5d444143ea
commit 2f6fccb912
5 changed files with 30 additions and 18 deletions

View file

@ -43,6 +43,14 @@ class Conference < ActiveRecord::Base
def confirmed
where(state: :confirmed)
end
def keynotes
where(state: :confirmed).select { |e| e.event_type.title == 'Keynote'}
end
def highlights
where(is_highlight: true)
end
end
has_many :event_users, through: :events
has_many :speakers, -> { distinct }, through: :event_users, source: :user do
@ -558,18 +566,6 @@ class Conference < ActiveRecord::Base
email_settings.updated_conference_registration_dates_template
end
def keynotes
events.where(state: 'confirmed').select { |e| e.event_type.title == 'Keynote'}
end
##
#
# ====Returns
# * +Array+ -> Events with attribute 'is_highlight'
def highlights
events.where(is_highlight: true)
end
private
after_create do