Fix Stellas review gripes

This commit is contained in:
Henne Vogelsang 2014-12-09 15:19:01 +01:00
parent d13efa5f52
commit c6bd65deaa
6 changed files with 51 additions and 46 deletions

View file

@ -11,7 +11,7 @@ class ConferenceRegistrationsController < ApplicationController
def show
@workshops = @registration.workshops
@total_price = Ticket.total_price(@conference, current_user)
@tickets = current_user.ticket_purchases.where(conference_id: 1)
@tickets = current_user.ticket_purchases.where(conference_id: @conference.id)
end
def edit; end

View file

@ -1,8 +1,15 @@
class TicketsController < ApplicationController
before_filter :authenticate_user!
load_resource :conference, find_by: :short_title
load_resource :tickets, class: Ticket
load_resource :ticket, through: :conference
authorize_resource :conference_registrations, class: Registration
before_filter :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
end