I am receiving the following error "NameError: uninitialized constant Stripe" when I ran
Stripe::Customer.all in the rails console. This was from following along on your class Stripe Subscription class. I got it to work with your code examples, but as I am applying what I learned to my codebase I am getting the NameError, is there something I am missing?
Stripe.api_key = Rails.application.secrets.stripe_private_key
gem 'stripe', '~> 3.3', '>= 3.3.1'
development: secret_key_base: <my keys are inserted here> stripe_public_key: <my keys are inserted here> stripe_private_key: <my keys are inserted here> test: secret_key_base: <my keys are inserted here> stripe_public_key: <my keys are inserted here> stripe_private_key: <my keys are inserted here> ....
Here is the full stack trace:
Running via Spring preloader in process 26483 Loading development environment (Rails 5.0.3) cannot load such file -- awesome_print irb: warn: can't alias context from irb_context. 2.4.1 :001 > Stripe::Customer.all NameError: uninitialized constant Stripe from (irb):1 from /Users/portatlas/.rvm/gems/ruby-2.4.1/gems/railties-5.0.3/lib/rails/commands/console.rb:65:in `start' from /Users/portatlas/.rvm/gems/ruby-2.4.1/gems/railties-5.0.3/lib/rails/commands/console_helper.rb:9:in `start' from /Users/portatlas/.rvm/gems/ruby-2.4.1/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:78:in `console' from /Users/portatlas/.rvm/gems/ruby-2.4.1/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /Users/portatlas/.rvm/gems/ruby-2.4.1/gems/railties-5.0.3/lib/rails/commands.rb:18:in `<top (required)>' from /Users/portatlas/Desktop/canobie_films/testsubscriptionsite/bin/rails:9:in `<top (required)>' from /Users/portatlas/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /Users/portatlas/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from -e:1:in `<main>' ``` Thank you,
Did you run bundle install after adding the Stripe gem?
Also, did you try stopping and restarting your rails console? Your changes may not have taken affect if your console was running when you made them.
It looks like I have my Stripe gem configured correctly, when I start my server my app can hit Stripe's api correctly it just doesn't seem to work on the console. I am wondering if it has anything to do with the warnings I get when I start
Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.