osem-fcy/app/controllers/tickets_controller.rb
James Mason 199bc00c08
Add (admin-only) tickets via 'visibile' attribute [migration]
(cherry picked from commit ce0db3d7a736e7bcde480721986dbfb4a82aa083)
2025-08-14 17:36:31 +02:00

22 lines
617 B
Ruby

# 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
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