app/controllers/batches_controller.rb
# Set @ticket_kinds variable or redirect to new ticket kind form if none are available.
Set @ticket_kinds variable or redirect to new ticket kind form if none are available.
Set @ticket_kinds variable or redirect to new ticket kind form if none are available .
def assign_ticket_kinds_or_redirect
    if TicketKind.count == 0
      flash[:error] = "You must create at least one kind of ticket before creating tickets."
      redirect_to new_ticket_kind_path
    else
      @discount_ticket_kinds = TicketKind.discount_kinds.ordered
      @access_ticket_kinds = TicketKind.access_kinds.ordered
    end
  end
def assign_ticket_kinds_or_redirect if TicketKind . count == 0 flash [ :error ] = "You must create at least one kind of ticket before creating tickets." redirect_to new_ticket_kind_path else @discount_ticket_kinds = TicketKind . discount_kinds . ordered @access_ticket_kinds = TicketKind . access_kinds . ordered end end
Set @ticket_kinds variable or redirect to new ticket kind form if none are available.
Set @ticket_kinds variable or redirect to new ticket kind form if none are available .