RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.

Home Page:http://railsapps.github.io/rails-stripe-membership-saas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SyntaxError at /users/sign_up

opened this issue · comments

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 RailsApps/rails-stripe-coupons#1
Is this the same fix? I haven't tried anything yet.

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"}

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

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

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?

Yes. You are correct, my error.