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,

Reply

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?

Reply

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

Reply

Always the easy things! 😉

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

Reply
Join the discussion
Create an account Log in

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

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

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