Modify conference registration to a singular resource
This commit is contained in:
parent
8b831b1977
commit
0675572e05
17 changed files with 37 additions and 37 deletions
|
|
@ -7,13 +7,13 @@ class TicketPurchasesController < ApplicationController
|
|||
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
|
||||
if message.blank?
|
||||
if current_user.ticket_purchases.any?
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
notice: "Thank you for supporting #{@conference.title} by purchasing a ticket."
|
||||
else
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title)
|
||||
redirect_to conference_conference_registration_path(@conference.short_title)
|
||||
end
|
||||
else
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
error: "Oops, something went wrong with your purchase! #{message}"
|
||||
end
|
||||
end
|
||||
|
|
@ -21,10 +21,10 @@ class TicketPurchasesController < ApplicationController
|
|||
def destroy
|
||||
@ticket_purchases = current_user.ticket_purchases.find(params[:id])
|
||||
if @ticket_purchases.destroy
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
notice: 'Ticket successfully deleted.'
|
||||
else
|
||||
redirect_to conference_conference_registrations_path(@conference.short_title),
|
||||
redirect_to conference_conference_registration_path(@conference.short_title),
|
||||
error: 'An error prohibited deleting your purchase! '\
|
||||
"#{@ticket_purchases.errors.full_messages.join('. ')}."
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue