osem-fcy/app/controllers/conferences_controller.rb

33 lines
849 B
Ruby
Raw Normal View History

class ConferencesController < ApplicationController
protect_from_forgery with: :null_session
before_action :respond_to_options
load_and_authorize_resource find_by: :short_title, except: :show
2014-08-12 11:51:59 +03:00
2014-11-14 17:24:24 +01:00
def index
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
2014-11-14 17:24:24 +01:00
@antiquated = @conferences - @current
end
def show
@conference = if params[:id]
Conference.find_by_short_title(params[:id])
else
load_conference_by_domain
end
authorize! :show, @conference
@program = @conference.program
end
2014-06-30 19:24:26 +05:30
2014-11-14 17:24:24 +01:00
private
def load_conference_by_domain
Conference.find_by(custom_domain: request.domain)
end
2015-10-28 18:05:15 +02:00
def respond_to_options
respond_to do |format|
format.html { head :ok }
end if request.options?
end
end