RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.
http://railsapps.github.io/rails-stripe-membership-saas
1.14k stars 232 forks source link

SyntaxError at /users/sign_up #117

Closed ghost closed 9 years ago

ghost commented 9 years ago

I went through the new tutorial "Membership Site With Stripe" for Rails 4.2. I followed the tutorial exactly copying and pasting the code into my Rails app. I went all the way through and stopped at the Webhooks section. I fired up the server and everything worked great until I tried to subscribe to one of the plans. Then I got these errors:

SyntaxError at /users/sign_up syntax error, unexpected ':', expecting => ...e}, { name: nil, 'data-stripe': 'exp-month' } );@output_buff... ... ^ /app/views/devise/registrations/new.html.erb:44: syntax error, unexpected '}', expecting ')' ...l, 'data-stripe': 'exp-month' } );@output_buffer.safe_append... ... ^ /app/views/devise/registrations/new.html.erb:45: syntax error, unexpected ':', expecting => ...0}, { name: nil, 'data-stripe': 'exp-year' } );@output_buffe... ... ^ /app/views/devise/registrations/new.html.erb:45: syntax error, unexpected '}', expecting ')' ...il, 'data-stripe': 'exp-year' } );@output_buffer.safe_append... ... ^ /app/views/devise/registrations/new.html.erb:48: syntax error, unexpected keyword_end, expecting ')' '.freeze; end ^ /app/views/devise/registrations/new.html.erb:51: syntax error, unexpected keyword_ensure, expecting ')' /app/views/devise/registrations/new.html.erb:53: syntax error, unexpected keyword_end, expecting ')'

Line 44 in app/views/devise/registrations/new.html.erb is: <%= select_month nil, { use_two_digit_numbers: true}, { name: nil, 'data-stripe': 'exp-month' } %>

There appeared to be a similar problem on the "Rails-Stripe-Coupon" RailsApp with Ruby 2.1.5. And I am running Ruby 2.1.5. Listed here https://github.com/RailsApps/rails-stripe-coupons/issues/1 Is this the same fix? I haven't tried anything yet.

ghost commented 9 years ago

I went ahead and changed: { name: nil, 'data-stripe': 'exp-month' } to { name: nil, data: {stripe: 'exp-month' } } in the "Card Expiry" section. Now the form is working properly. Was this the correct fix?

However, a new problem has arisen. When I submit the form I get this error:

{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank"}

DanielKehoe commented 9 years ago

Thanks for pointing this out. I've updated the starter application and the tutorial.

kathyonu commented 9 years ago

should have only one closing brace { name: nil, data: {stripe: 'exp-month' }

ghost commented 9 years ago

You need them both, one to close the first one in front of name and the other to close the one in front of stripe. Yes?

kathyonu commented 9 years ago

Yes. You are correct, my error.