I'm now completely confused with AWS NameError after I updated bundle in Ruby. The command was bundle update.
The below is my Gemfile.lock
DEPENDENCIES
actionmailer_inline_css
aws-sdk
...
awesome_print (1.6.1)
aws-sdk (2.3.9)
aws-sdk-resources (= 2.3.9)
aws-sdk-core (2.3.9)
jmespath (~> 1.0)
aws-sdk-resources (2.3.9)
aws-sdk-core (= 2.3.9)
.
My Gemfile includes
gem 'aws-sdk'
However I have no idea why suddenly this problem occurred. Are there anyone having this issue before and ending up fixing this error? please share with me! I'm desperate to fix this problem..
I have aws.rb file in the initializers.
AWS.config(
#:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:access_key_id => 'XX',
#:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
:secret_access_key => 'X/X/X/X'
)
#S3_BUCKET = AWS::S3.new.buckets[ENV['S3_BUCKET']]
S3_BUCKET = AWS::S3.new.buckets['XX']
Ruby version is 2.1.5
The entire error message when typing rails s is as follow:
/Users/sungpah/XX/config/initializers/aws.rb:1:in `<top (required)>': uninitialized constant AWS (NameError)
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/engine.rb:615:in `each'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `each'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /Users/sungpah/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
from /Users/sungpah/ringle/config/environment.rb:5:in `<top (required)>'
from /Users/sungpah/ringle/config.ru:3:in `block in <main>'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from /Users/sungpah/ringle/config.ru:in `new'
from /Users/sungpah/ringle/config.ru:in `<main>'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in `app'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands/server.rb:78:in `start'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/sungpah/ringle/bin/rails:8:in `require'
from /Users/sungpah/ringle/bin/rails:8:in `<top (required)>'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `load'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `call'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/spring-1.7.1/lib/spring/client/command.rb:7:in `call'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/spring-1.7.1/lib/spring/client.rb:30:in `run'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/spring-1.7.1/bin/spring:49:in `<top (required)>'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `load'
from /Users/sungpah/.rvm/gems/ruby-2.1.5/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/sungpah/ringle/bin/spring:13:in `require'
from /Users/sungpah/ringle/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
The issue is you have to use "Aws" instead of "AWS" for version 2 AWS SDK see below use the below code. AWS SDK Version 2 uses the "Aws" namespace, not "AWS".
Aws.config(
#:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:access_key_id => 'XXXXXXXXX',
#:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
:secret_access_key => 'XXXXXXX'
)
#S3_BUCKET = AWS::S3.new.buckets[ENV['S3_BUCKET']]
S3_BUCKET = Aws::S3.new.buckets['ringlecourse']
Also read this documentation for AWS SDK upgrades http://docs.aws.amazon.com/sdkforruby/api/
Change initialiser code inside aws.rb to
Aws.config.update({
credentials: Aws::Credentials.new(
ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
})
Reference
Upgrading from the Amazon AWS SDK v1 to v2 contains a few surprises. The most immediately impacting surprise is that the name AWS was changed to Aws, requiring code changes in order to simply update the gem.
The AWS SDK for Ruby - Version 2 guide will help with the details. The very first entry in this guide concerns the NameError: uninitialized constant AWS error that you encountered. An overview of the list of changes, features, and improvements of the AWS SDK v2 are documented in Announcing V2 of the AWS SDK for Ruby, and that's worth a read to know what to expect.
Note that you can continue using the AWS SDK v1 alongside the AWS SDK v2 gem if you like, simply by including both gems in your Gemfile:
gem 'aws-sdk', '~> 2'
gem 'aws-sdk-v1'
This will allow your existing code to work without changes. That's definitely a good thing. Note that to continue using the v1 gem, you have to now refer to it as aws-sdk-v1 in the Gemfile. This is a nice feature, and will allow you to migrate completely to the v2 gem on your own schedule, while still being able to use the new v2 features immediately.
Step back and consider whether you're fully aware of what's in the new gem, and why you want to upgrade. Once you do that, you may find that it's simply not the right time for an upgrade. New versions are not always better, and sometimes upgrading a component can heavily impact a project. Consider biting off a small research project to investigate the real impact of upgrading to the gem version; you may find that it's not even necessary, especially if you don't have requirements that make use exclusively of the new gem version's features.
Related
After I upgrade my Rails app from 5.0.2 to 5.1.1, errors appear like that:
No such middleware to insert after: "ActionDispatch::DebugExceptions"
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:106:in `assert_index'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:80:in `insert_after'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/configuration.rb:69:in `block in merge_into'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/configuration.rb:68:in `each'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/configuration.rb:68:in `merge_into'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/engine.rb:507:in `block in app'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/engine.rb:504:in `synchronize'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/engine.rb:504:in `app'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application/finisher.rb:45:in `block in <module:Finisher>'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `instance_exec'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `run'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:59:in `block in run_initializers'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:58:in `run_initializers'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application.rb:353:in `initialize!'
/Users/thiensubs/Documents/super-control/config/environment.rb:5:in `<top (required)>'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application.rb:329:in `require_environment!'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/command.rb:46:in `invoke'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => middleware => environment
(See full trace by running task with --trace)
My ruby version is: 2.4.1
Older Rails version is: 5.0.2
My lasted version is: 5.1.1
Any body can help me with that?
I ran into the same problem and after grepping insert_after method in my gem folders, it was an outdated airbrake gem which causes the problem.
Relax the version in Gemfile and bundle update airbrake seems to fix it.
I am working on integrating Stripe with my Rails app. Per Stripe's documentation, I've added the following to 'config/initializers/stripe.rb', and set the environmental variables to the test keys:
Rails.configuration.stripe = {
:publishable_key => ENV['PUBLISHABLE_KEY'],
:secret_key => ENV['SECRET_KEY']
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
(Editing to add that as suggested, I changed this to the following)
Rails.configuration.stripe = {
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'] ||= Rails.application.secrets.stripe_publishable_key,
:secret_key => ENV['STRIPE_SECRET_KEY'] ||= Rails.application.secrets.stripe_secret_key,
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
When I try to do anything now (generate a controller, say, or run the server), I get an error saying I have an "undefined method `secret_key'":
$ rails s
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/usr/local/rvm/gems/ruby-2.1.5#rails4/gems/stripe-rails-0.3.1/lib/stripe/engine.rb:20:in `block in <class:Engine>': undefined method `secret_key' for #<Hash:0x000000066aa1e8> (NoMethodError)
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
from /home/ubuntu/workspace/junkyardstorefinal/config/environment.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/ubuntu/workspace/junkyardstorefinal/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
from /home/ubuntu/workspace/junkyardstorefinal/config.ru:in `new'
from /home/ubuntu/workspace/junkyardstorefinal/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands/server.rb:61:in `app'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands/server.rb:78:in `start'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /home/ubuntu/workspace/junkyardstorefinal/bin/rails:8:in `require'
from /home/ubuntu/workspace/junkyardstorefinal/bin/rails:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.1.5#rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/ubuntu/workspace/junkyardstorefinal/bin/spring:13:in `require'
from /home/ubuntu/workspace/junkyardstorefinal/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
What other data would be helpful to anyone who can help? That's the entirety of stripe.rb up there, and I can't find anywhere else that I've used "secret_key" or anywhere else that it appears in the tutorial I was originally working through. Nor have I touched any of the files mentioned in the full trace.
Oddly, although I can't start the server on Cloud9, when I use Heroku to look at it, the app launches and works just fine -- other than a problem connecting to Redis that prevents it from displaying the user's cart.
(Updating to add: now that I've merged the branch I was on and tried to push the merged master branch, which means Heroku compiles it now, I find that I also can't push to Heroku from the master branch without getting "NoMethodError: undefined method `secret_key' for #" and "push rejected".)
I think your error is the ENV['PUBLISHABLE_KEY'] and ENV['SECRET_KET'] is nil.
To solve your problem. In the terminal
$export PUBLISHABLE_KEY=yourpublisablekey
$export SECRET_KEY=yoursecretkey
$rails s
I would like to encourage you to put your key's in your secret.yml like
development:
stripe_publishable_key: yourpublisablekey
stripe_secret_key: yoursecretkey
production:
stripe_publishable_key: yourpublisablekey
stripe_secret_key: yoursecretkey
You can access this by simple adding Rails.application.secrets.stripe_publishable_key and Rails.application.secrets.stripe_secret_key
For example in your config/initializers/stripe.rb
Rails.configuration.stripe = {
:publishable_key => ENV['PUBLISHABLE_KEY'] ||= Rails.application.secrets.stripe_publishable_key,
:secret_key => ENV['SECRET_KEY'] ||= Rails.application.secrets.stripe_secret_key
}
Hope it helps.
It turned out that the solution was to take out the last line of stripe.rb entirely. I commented it out at the suggestion of someone over at CodeNewbie, to make sure that it was actually setting my stripe configurations. Surprisingly, once I commented that line out (
'Stripe.api_key = Rails.configuration.stripe[:secret_key]'), everything started working perfectly.
Years later I came across a similar issue with stripe-rails, using Rails 5.2.1
The solution was to add the keys to credentials, as per current rails standard, and instead of using an initializer 'stripe.rb' I used the development.rb and production.rb files inside the envirnoments folder.
So, on my development.rb I have something like this:
Rails.configuration.stripe.secret_key = Rails.application.credentials.stripe[:dev_secret_key]
Rails.configuration.stripe.publishable_key = Rails.application.credentials.stripe[:dev_publishable_key]
And similar code for production.rb
My rails project works before. I got this error because I deleted mysql and everything associated mysql.
Then I reinstalled mysql. It got this error. Then I reinstalled ruby and rails. The error is still here. Using "rails new myapp",
then "bundle instal",
then "rails s",
I got the following error:
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
**/home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `active_record' for #<Rails::Application::Configuration:0x0000000303cae8> (NoMethodError)
from /home/cwu/Dropbox/project/web/atop/config/environments/development.rb:23:in `block in <top (required)>'**
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `class_eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:24:in `configure'
from /home/cwu/Dropbox/project/web/atop/config/environments/development.rb:1:in `<top (required)>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:590:in `block in <class:Engine>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/cwu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/cwu/Dropbox/project/web/atop/config/environment.rb:5:in `<top (required)>'
from /home/cwu/Dropbox/project/web/atop/config.ru:3:in `require'
from /home/cwu/Dropbox/project/web/atop/config.ru:3:in `block in <main>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/cwu/Dropbox/project/web/atop/config.ru:in `new'
from /home/cwu/Dropbox/project/web/atop/config.ru:in `<main>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/cwu/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
The error is clear that in config/environments/development.rb:23 you configure active_record which is not loaded.
Just remove
config.active_record.migration_error = :page_load
Will be ok.
Leedy Liu is right to some degree, but if you're getting this error when you create a new Rails app, t suggests a deeper problem with your environment
According to this answer, you may have require "active_record/railtie" commented out in your application.rb file. Please check to make sure this is not the case
You may have to re-install Rails with ActiveRecord to ensure the functionality is restored with your app. Have you tried this:
gem install bundler
gem install rails
bundle install
Other than that, you need to ensure Ruby on Rails is installed correctly. What env are you running? Linux or Windows?
As a general fix, remove all references to active_record. Easiest way is to do a find on the root directory of "active_records", find all usages, and remove them. I found usages in config/application.rb and config/environments/development and production.rb.
Try:
'gem install bundler'
then:
'bundle install'
again.
See if it clears up.
Comment config.active_record.raise_in_transactional_callbacks = true in config/application.rb and config.active_record.migration_error = :page_load in config/environments/development.rb.
Sorry if this is a bad question, I'm trying to initially set up Rails, so I don't really know what I'm doing. In the tutorial I'm following it comes to a point at which is says to run "rails server," however this is returning some unexpected results.(See below)
Macbookpro:First Cameron$ sudo rails server
Password:
=> Booting WEBrick
=> Rails 4.1.0 application starting in development on http:// 0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' for #<Rails::Application::Configuration:0x007fea90b47760> (NoMethodError)
from /Users/admin/Rails/First/config/environments/development.rb:17:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/railtie.rb:210:in `instance_eval'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/railtie.rb:210:in `configure'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/railtie.rb:182:in `configure'
from /Users/admin/Rails/First/config/environments/development.rb:1:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/engine.rb:594:in `block (2 levels) in <class:Engine>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/engine.rb:593:in `each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/engine.rb:593:in `block in <class:Engine>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/initializable.rb:44:in `each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/initializable.rb:44:in `tsort_each_child'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `public_send'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `method_missing'
from /Users/admin/Rails/First/config/environment.rb:5:in `<top (required)>'
from /Users/admin/Rails/First/config.ru:3:in `require'
from /Users/admin/Rails/First/config.ru:3:in `block in <main>'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/admin/Rails/First/config.ru:in `new'
from /Users/admin/Rails/First/config.ru:in `<main>'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/server.rb:50:in `app'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/server.rb:130:in `log_to_stdout'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/server.rb:67:in `start'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Sorry if this is not needed, but I'm really unsure what to do with it.
I don't think you're alone in this error.
Make sure you coordinate your gem versions, and even better if specify the versions of your Rails & Ruby gems to avoid potential conflicts in versioning.
Posting your Gemfile would be helpful, but without seeing it, I'd say to specify your Ruby version at the top of your gemfile like:
source 'https://rubygems.org'
ruby '2.0.0'
Then specify your version of Rails. While I have had no problems with just providing:
gem 'rails'
You could be extra safe and specify a version like:
gem 'rails', '4.0.2'
Then run: bundle install for your app.
Take a look at the following tutorial. I realise that it is for windows however it solved all the initial problems I was having with my first install.
http://www.soheiokamoto.com/setting-up-ruby-on-rails-on-windows
The main point that helped me install perfectly was;
Run gem update on a fresh install to make sure everything is up to date
Problem:
m#m-Lenovo-IdeaPad-Y470:~/Dropbox/software/Rails/CIRCAR_CP_NEW$ rails s
Initialize SymmetricEncryption module.
=> Booting Thin
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config/initializers/registrations.rb:1:in `<top (required)>': cannot load such file -- devise_invitable/controllers/registrations (LoadError)
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `block in load'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/engine.rb:587:in `each'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config/environment.rb:7:in `<top (required)>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config.ru:3:in `block in <main>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config.ru:in `new'
from /home/m/Dropbox/software/Rails/CIRCAR_CP_NEW/config.ru:in `<main>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
from /home/m/.rvm/gems/ruby-1.9.3-p194#proof/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
If I run any rake commands, the same thing happens. All my other rails applications work just fine. It's just this one (the one I didn't write) that won't start.
I see that the problem is here: CIRCAR_CP_NEW/config/initializers/registrations.rb:1
CIRCAR_CP_NEW/config/initializers/registrations.rb
module DeviseInvitable::Controllers::Registrations
def self.included(controller)
controller.send :around_filter, :keep_invitation_info, :only => :create
end
...
yield
reset_invitation_info
end if resource_invitable
puts "Keep Invitation Info End"
puts "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
end
I just have no idea what to do about it. My understanding is that Rails is looking for something in this directory
devise_invitable/controllers/registrations
but is not finding it because that directory does not exist. Apparently the code works for the developers in India but they don't feel inclined to help me figure out why it's not running on my machine.
I'm running Ubuntu 12.04
Gemfile:
gem 'devise'
gem 'devise_invitable'
Bundle Install
m#m-Lenovo-IdeaPad-Y470:~/Dropbox/software/Rails/CIRCAR_CP_NEW$ bundle install
Using rake (10.0.4)
...
Using devise (2.2.4)
Using devise_invitable (1.1.8)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Are you certain that you have the devise gems are:
e.g.
bundle install
EDIT: If we know that the gems have been downloaded, there may be a problem with the Gem's configured load paths.
Within irb or pry run Gem.path
Check each of the returned paths for the devise libraries. If the devise directory structure is not found, we have found your problem.
It was a gem compatibility issue.
After version 1.1.4, the structure of devise_invitable changed.
devise_invitable/controllers/registrations
no longer exists. Therefore
module DeviseInvitable::Controllers::Registrations
needed to change to
module DeviseInvitable::RegistrationsControllers
to reflect the structure of the updated gem.
The other solution would be to add the version number to the gemfile and make sure I am using a compatible version so that things are being referenced as expected.
The server and rake commands now run, but there are a number of other issues I have to figure out now :P