Sending Data Between Controllers And Views | GoRails
Is there a way to pass the variable that was sent to the view back to the controller with a new value?
That's generally not something you would want to do unless you are talking about AJAX. What are you trying to accomplish?
I've written a post about it here http://code.seanosaur.com/r... instead of writing the entire issue out again.
Ah I see now. So the stripe button JS takes an amount simply to display the amount. On the backend, you are always submitting charge for the same amount which is why you're seeing that problem.
To solve this, you want to define some "plans" and submit that to the create action along with the stripe card token. You can do that in hidden fields, but you want to do that instead of submitting the amount so users can't submit their own amount which would be a security issue. If you send over the plan name and look up the amount (you can hardcode this into your app), then you can calculate the appropriate price. Does that make more sense?
Chris, apologies for the extremely late response, but your comment helped me quite bit. Just wanted to say 'thanks!'
Simple and concise indeed, it demystifies the underlying operation of Rails. Good work!
I've just finished going through the Railstutorial by Michael Hartl, and I'd just like to say that your videos (especially these first few) really demystify what is going on under the hood of rails. That is, you've made everything 'click' for me. Thank you!