Modify conference registration to a singular resource

This commit is contained in:
Arun Kumar 2016-07-05 00:10:18 +05:30
parent 8b831b1977
commit 0675572e05
No known key found for this signature in database
GPG key ID: 6C40CA6462DEA424
17 changed files with 37 additions and 37 deletions

View file

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