move params merge to private method

This commit is contained in:
Rishabh Saxena 2016-08-08 23:36:16 +05:30
parent 05e2a061cc
commit 4b0a5b1125
2 changed files with 7 additions and 6 deletions

View file

@ -14,10 +14,7 @@ class PaymentsController < ApplicationController
end
def create
@payment = Payment.new payment_params.merge(stripe_customer_email: params[:stripeEmail],
stripe_customer_token: params[:stripeToken],
user: current_user,
conference: @conference)
@payment = Payment.new payment_params
if @payment.purchase && @payment.save
update_purchased_ticket_purchases
@ -33,7 +30,10 @@ class PaymentsController < ApplicationController
private
def payment_params
params.permit :stripe_customer_email, :stripe_customer_token
params.permit(:stripe_customer_email, :stripe_customer_token)
.merge(stripe_customer_email: params[:stripeEmail],
stripe_customer_token: params[:stripeToken],
user: current_user, conference: @conference)
end
def update_purchased_ticket_purchases