use short-form presence validator.
use two-argument form. add unpaid scope. repair tests.
This commit is contained in:
parent
893f517ab0
commit
888c7a8524
6 changed files with 24 additions and 36 deletions
|
|
@ -28,7 +28,7 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@total_price = Ticket.total_price(@conference, current_user, :paid => true)
|
||||
@total_price = Ticket.total_price(@conference, current_user, paid: true)
|
||||
@tickets = current_user.ticket_purchases.where(conference_id: @conference.id, paid: true)
|
||||
@ticket_payments = @tickets.group_by(&:payment_id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class TicketPurchasesController < ApplicationController
|
|||
TicketPurchase.destroy_all(user_id: current_user.id, conference_id: @conference.id, paid: false)
|
||||
message = TicketPurchase.purchase(@conference, current_user, params[:tickets][0])
|
||||
if message.blank?
|
||||
if current_user.ticket_purchases.where(paid: false).any?
|
||||
if current_user.ticket_purchases.unpaid.any?
|
||||
redirect_to new_conference_payment_path, notice: 'Please pay here to purchase tickets.'
|
||||
else
|
||||
redirect_to conference_conference_registration_path(@conference.short_title)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue