2014-08-28 15:21:05 +02:00
|
|
|
class TicketsController < ApplicationController
|
2014-11-06 14:58:51 +01:00
|
|
|
before_filter :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
|
2014-12-09 15:19:01 +01:00
|
|
|
before_filter :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?
|
2015-10-17 16:57:48 +03:00
|
|
|
flash[:notice] = "There are no tickets available for #{@conference.title}!"
|
|
|
|
|
redirect_to root_path
|
2014-12-09 15:19:01 +01:00
|
|
|
end
|
|
|
|
|
end
|
2014-08-28 15:21:05 +02:00
|
|
|
end
|