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

View file

@ -15,4 +15,5 @@
.col-md-13 .col-md-13
%p.text-muted.text-center %p.text-muted.text-center
%small %small
The payment is totally secure. Your credit card details will be sent directly to our payment processor. All payments are handled securely by our payment processor,
= link_to 'Stripe', 'https://stripe.com', target: '_blank'