Skip to main content
Ask A Question
Notifications
You’re not receiving notifications from this thread.
Subscribe

How do I resolve this syntax error

Rails • Asked by Jim Miller

Hi guys,

I have this error and I don't understand what the error is. I'm using Rails 6

syntax error, unexpected tLABEL
stripe_id: customer.id,
~~~~~~~~~
/vagrant/Rails/stripe-test/app/controllers/subscriptions_controller.rb:34: syntax error, unexpected tLABEL, expecting '='

My code is:
options = (
stripe_id: customer.id,
stripe_subscription_id: subscription.id
)

current_user.update(options)

Thanks,
Jim


Presumably you meant options to be a hash? You used () instead of {}

options = {
  stripe_id: customer.id,
  stripe_subscription_id: subscription.id
}

That's it! Thanks!


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.