All threads / Stripe Payments

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Stripe Payments

Corey Holmes asked in Gems / Libraries

Hey, love the new Stripe video but I'm stuck on something.

I am getting the error: uninitialized constant ActionView::CompiledTemplates::STRIPE_PUBLIC. It's having a problem with my meta tag which I placed on the application.html.erb

I have this in my JS file:
$ Stripe.setPublishableKey( $("meta[name='stripe-key']").attr("content"))

And then this in my application.html.erb file:
<%= tag :meta, name: "stripe-key", content: STRIPE_PUBLIC %>

And then at the bottom of my development.rb file I have
STRIPE_SECRET = "xxxxxxxxxxxxxxxxxxxxxxx"
STRIPE_PUBLIC = "xxxxxxxxxxxxxxxxxxxxxxx"

Any idea why I might be getting this error?
Thanks,

It sounds like you've got everything but may just need to restart your rails server to pickup the constant in the config file. Have you tried that?

Oh man haha. That always works. Thanks a lot Chris.

Always the easy things! 😉

Last night I got tripped up on making a pluralization mistake for like 45 minutes. :)

Join the discussion

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

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

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

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.