2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-08-28 15:21:05 +02:00
|
|
|
class TicketsController < ApplicationController
|
2017-09-05 22:23:34 +03:00
|
|
|
before_action :authenticate_user!
|
2014-08-28 15:21:05 +02:00
|
|
|
load_resource :conference, find_by: :short_title
|
2014-12-09 15:19:01 +01:00
|
|
|
load_resource :ticket, through: :conference
|
2014-08-28 15:21:05 +02:00
|
|
|
authorize_resource :conference_registrations, class: Registration
|
2017-09-05 22:23:34 +03:00
|
|
|
before_action :check_load_resource, only: :index
|
2014-08-28 15:21:05 +02:00
|
|
|
|
|
|
|
|
def index; end
|
2014-12-09 15:19:01 +01:00
|
|
|
|
|
|
|
|
def check_load_resource
|
|
|
|
|
if @tickets.empty?
|
|
|
|
|
redirect_to root_path, notice: "There are no tickets available for #{@conference.title}!"
|
|
|
|
|
end
|
|
|
|
|
end
|
2014-08-28 15:21:05 +02:00
|
|
|
end
|