Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I resolve this syntax error

Jim Miller asked in Rails

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

Reply

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

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

That's it! Thanks!

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 74,071+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.