Getting a Mass Asssignment Error using Stripe

By : sacshu
Source: Stackoverflow.com
Question!

I'm trying to implement Stripe payments in my rails app. I'm pretty much following the tutorial in the railscasts and just customizing it, but I seem to be getting stuck with mass assignment errors related to the stripe_card_token. Any ideas why this is happening?

Here's a bunch of my code http://pastie.org/4191557

By : sacshu


Answers

In your Stripe_token migration, field name is :stripe_customer_token and you have written :stripe_card_token

Generally, Cannot mass-assign' means you cannot assign a value automatically like this: @idea.pledges.create(params[:pledge])

Either use attr_accessible :stripe_customer_token

OR

Directly assign value

@idea.pledges.stripe_customer_token = params[:pledge][:stripe_customer_token]

By : GBD


This video can help you solving your question :)
By: admin