osem-fcy/app/controllers/tickets_controller.rb

23 lines
617 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class TicketsController < ApplicationController
before_action :authenticate_user!
load_resource :conference, find_by: :short_title
before_action :load_tickets
authorize_resource :ticket, through: :conference
authorize_resource :conference_registrations, class: Registration
before_action :check_load_resource, only: :index
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
def load_tickets
@tickets = @conference.tickets.visible
end
end