rails can't find database.yml - ruby-on-rails

I just removed my database.yml because I'm trying to use Mongoid, and now I'm getting the following:
$ rails server
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application/configuration.rb:88:in `read': No such file or directory - /home/chris-kun/code/thirsty/config/database.yml (Errno::ENOENT)
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application/configuration.rb:88:in `database_configuration'
from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/railtie.rb:58:in `block (2 levels) in <class:Railtie>'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/railtie.rb:57:in `block in <class:Railtie>'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `block in run_initializers'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
from /home/chris-kun/code/thirsty/config/environment.rb:5:in `<top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
from /home/chris-kun/code/thirsty/config.ru:3:in `block in <main>'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /home/chris-kun/code/thirsty/config.ru:1:in `new'
from /home/chris-kun/code/thirsty/config.ru:1:in `<main>'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
1 #!/usr/bin/env ruby
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands/server.rb:65:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:30:in `block in <top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Any ideas?

In config/application.rb, remove the line require 'rails/all' and replace with:
require "rails"
%w(
action_controller
action_mailer
active_resource
rails/test_unit
).each do |framework|
begin
require "#{framework}/railtie"
rescue LoadError
end
end
(This is the contents of rails/all.rb in the railties gem, but with the activerecord line removed).

I had a similair issue before, but it turns out I had some scattered active_record references lying around. Full credit to Dylan Markow for this one!
Removing database.yml when using Mongoid in Rails 3.2
Execute grep -r active_record config/ to find all references, then comment them out!

For those of you who want to use db related functions ex) rake db:seed with mongoid, also add the mongoid railtie:
https://github.com/mongodb/mongoid/tree/master/lib/mongoid/railties
require "rails"
# Import gems in Gemfile
Bundler.require(*Rails.groups)
# important that this is imported after gems in Gemfile are imported
%w(
mongoid
action_controller
action_mailer
active_resource
rails/test_unit
).each do |framework|
begin
require "#{framework}/railtie"
rescue LoadError
end
end

An updated answer for Rails 5 and all future versions of Rails:
You should be using the require snippet from the rails/all.rb file that is current with your version of Rails without the active_record railtie. Here is a link to rails/all.rb on the Rails master branch.
As of writing this it includes a number of new railties which you don't want to miss out on:
require "rails"
%w(
action_controller/railtie
action_view/railtie
action_mailer/railtie
active_job/railtie
action_cable/engine
rails/test_unit/railtie
sprockets/railtie
).each do |railtie|
begin
require railtie
rescue LoadError
end
end

Related

superclass must be an instance of Class (given an instance of Module) (TypeError) when doing `cucumber -s`

I cant seem to be able to figure out
The error logs are as follow
superclass must be an instance of Class (given an instance of Module) (TypeError)
/home/asus/code/ruby-project/cucumber/config/application.rb:11:in `<module:Cucumber>'
/home/asus/code/ruby-project/cucumber/config/application.rb:9:in `<top (required)>'
/home/asus/code/ruby-project/cucumber/config/environment.rb:2:in `require_relative'
/home/asus/code/ruby-project/cucumber/config/environment.rb:2:in `<top (required)>'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-rails-2.5.1/lib/cucumber/rails.rb:12:in `require'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-rails-2.5.1/lib/cucumber/rails.rb:12:in `<top (required)>'
/home/asus/code/ruby-project/cucumber/features/support/env.rb:7:in `require'
/home/asus/code/ruby-project/cucumber/features/support/env.rb:7:in `<top (required)>'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/glue/registry_and_more.rb:122:in `require'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/glue/registry_and_more.rb:122:in `load_code_file'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/runtime/support_code.rb:142:in `load_file'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/runtime/support_code.rb:81:in `block in load_files!'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/runtime/support_code.rb:80:in `each'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/runtime/support_code.rb:80:in `load_files!'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/runtime.rb:278:in `load_step_definitions'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/runtime.rb:74:in `run!'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/lib/cucumber/cli/main.rb:29:in `execute!'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/cucumber-7.1.0/bin/cucumber:9:in `<top (required)>'
/home/asus/.rbenv/versions/3.1.2/bin/cucumber:25:in `load'
/home/asus/.rbenv/versions/3.1.2/bin/cucumber:25:in `<top (required)>'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `load'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:23:in `run'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:486:in `exec'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:48:in `block in <top (required)>'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
/home/asus/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.22/exe/bundle:36:in `<top (required)>'
/home/asus/.rbenv/versions/3.1.2/bin/bundle:25:in `load'
/home/asus/.rbenv/versions/3.1.2/bin/bundle:25:in `<main>'
The application.rb is as followed
require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Cucumber
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
end
end
There are threads with similar issues (ruby on rails : <top (required)>': superclass must be a Class (Symbol given) (TypeError)), I am not sure it can be applied in this case. I tried to reinstall rails, downgrading cucumber-rails. The issue is still persisted.
I guess the problem is that you named your Ruby on Rails application Cucumber while having the cucumber gem installed too. And that this confuses Ruby.
I suggest naming your Ruby on Rails application differently and not using the same name as a well-known gem.

ArgumentError: tried to create Proc object without a block

How can I resolve the following error:
$ rails db:migrate
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name,
spell_checker)' instead.
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name,
spell_checker)' instead.
rails aborted!
ArgumentError: tried to create Proc object without a block
D:/Projects/lms-2021/config/application.rb:9:in `<top (required)>'
D:/Projects/lms-2021/Rakefile:4:in `require_relative'
D:/Projects/lms-2021/Rakefile:4:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
(See full trace by running task with --trace)
These are the logs after rails db:migrate --trace:
$ rails db:migrate --trace
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
rails aborted!
ArgumentError: tried to create Proc object without a block
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:472:in `new'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:472:in `service_added'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:510:in `<module:Aws>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:18:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `block in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in `load_dependency'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-resources-2.9.24/lib/aws-sdk-resources.rb:1:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `block in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:258:in `load_dependency'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-5.1.7/lib/active_support/dependencies.rb:292:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/aws-sdk-2.9.24/lib/aws-sdk.rb:1:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:66:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:61:in `each'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:61:in `block in require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:50:in `each'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler/runtime.rb:50:in `require'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bundler-2.2.3/lib/bundler.rb:174:in `require'
D:/Projects/lms-2021/config/application.rb:9:in `<top (required)>'
D:/Projects/lms-2021/Rakefile:4:in `require_relative'
D:/Projects/lms-2021/Rakefile:4:in `<top (required)>'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in `load'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in `load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:703:in `raw_load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:104:in `block in load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:103:in `load_rakefile'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands/rake/rake_command.rb:18:in `perform'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/command.rb:46:in `invoke'
D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
This is the application.rb file where the error is shown:
require 'uri'
require "uri/generic"
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Ilms
class Application < Rails::Application
config.to_prepare do
# Load application's model / class decorators
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
# Load application's view overrides
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
config.assets.initialize_on_precompile = false
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
end
end
I am not understanding where is the error and how to fix it. There seems no error in my code. The logs with --trace are showing the error occured in lib/ruby/gems/3.1.0/gems/aws-sdk-core-2.9.24/lib/aws-sdk-core.rb:472:in `new' which callback = Proc.new .
Database : postgresql
gem 'pg' already installed
rails v 5.1.7
ruby v 3.1.2
windows 10 pro
git bash terminal
You seem to be using an old version of Rails (5.1.7, EOL status) with a very new version of Ruby (3.1.2).
This error is probably a breaking change introduced in Ruby 3 that needs libraries to be adapted for it (see this case with Anycable here: https://github.com/anycable/anycable/issues/118)
As per this article : https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html you cannot use a Ruby version higher than 2.6.0 with Rails 5.1.x
The solution would be to use Ruby 2.6.0 or to upgrade your Rails app to a newer version.

LoadError: cannot load such file -- zip/zip when running any rails command after upgrade

I've just upgraded to rails 6, and I'm getting the following when running rails app:update
rails aborted!
LoadError: cannot load such file -- zip/zip
/home/ben/code/app/config/application.rb:7:in `<top (required)>'
/home/ben/code/app/Rakefile:5:in `<top (required)>'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
I've updated all the gems and it's bundling and updating the gems, the gemfile.lock looks OK as well.
Here is the backtrace:
Error:[rake --tasks] rake aborted!
LoadError: cannot load such file -- zip/zip
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `block in require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:299:in `load_dependency'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-6.1.3.2/lib/active_support/dependencies.rb:332:in `require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/axlsx-1.3.6/lib/axlsx.rb:26:in `<top (required)>'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.2.19/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.2.19/lib/bundler/runtime.rb:61:in `each'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.2.19/lib/bundler/runtime.rb:61:in `block in require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.2.19/lib/bundler/runtime.rb:50:in `each'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.2.19/lib/bundler/runtime.rb:50:in `require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-2.2.19/lib/bundler.rb:174:in `require'
/home/ben/code/app/config/application.rb:7:in `<top (required)>'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/ben/code/BusinessCloudEssential/Rakefile:5:in `<top (required)>'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/rake_module.rb:29:in `load_rakefile'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/application.rb:703:in `raw_load_rakefile'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/application.rb:104:in `block in load_rakefile'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/application.rb:103:in `load_rakefile'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/application.rb:82:in `block in run'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rake-13.0.3/lib/rake/application.rb:80:in `run'
/home/ben/code/app/bin/rake:4:in `<main>'
Here is the application.rb
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
require 'net/http'
require 'csv'
module RailsUpgrade
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.0
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.time_zone = 'London'
#WARNING: This changes the way times are stored in the database (not recommended)
config.active_record.default_timezone = :local
config.log_level = :debug
config.enable_dependency_loading = true
config.eager_load_paths << Rails.root.join('lib')
config.assets.enabled = true
config.assets.version = '1.0'
config.filter_parameters << :password
config.filter_parameters << :password_confirmation
config.filter_parameters << :card_number
config.filter_parameters += [:password, :password_confirmation, :card_number]
# config.middleware.use 'CatchJsonParseErrors'
end
end
Last time I ran rails app:update was when I updated to Rails 5.2 earlier today. So not sure what the issue is.
Thanks.
You are using axlsx version 1.3.6, which includes this line: require 'zip/zip'. That's what your error message is pointing to:
/home/ben/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/axlsx-1.3.6/lib/axlsx.rb:26:in `<top (required)>'
However, I suspect that you've also inadvertently upgraded the rubyzip gem to v1.0.0+ - where the API has changed, and you now only need to require 'zip', (NOT require 'zip/zip').
There are a few solutions, such as what's mentioned on the project README or in this similar StackOverflow question:
Downgrade rubyzip back to v0.x.
Upgrade axlsx.
Add gem 'zip-zip' to your Gemfile.

Devise Invitable LoadError

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

MongoDB connection error when I try to install any gem

I am trying to run Rails 3.2.3 using gem 1.8.23, Ruby 1.9.2p318 (2012-02-14 revision 34678) [x86_64-darwin10.8.0], MongoDB 1.6.2 with MongoMapper 0.11.0 and heroku.
I am able to start the rails server and use mongoDB both on development and on heroku. But whenever I try to install anything new (bootstrap for instance) or run 'rails s' command, I get the following error (pasted below). I assume it has something to do with mongodb and or mongo mapper. I have also enclosed the config files. I've been stuck with this since couple of days and any hints or ideas are highly appreciated. Unfortunately, this is my first RoR app and hence I may sound really stupid.
Error:
new-host:talker Name$ rails g bootstrap:install
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /Users/Name/Projects/talker/config/environment.rb:12)
/Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:330:in `rescue in receive_message_on_socket': Operation failed with the following exception: connection closed (Mongo::ConnectionFailure)
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:322:in `receive_message_on_socket'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:188:in `receive_header'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:175:in `receive'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/networking.rb:139:in `receive_message'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:469:in `block in send_initial_query'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/util/logging.rb:36:in `instrument'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:467:in `send_initial_query'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:458:in `refresh'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/cursor.rb:128:in `next'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/db.rb:511:in `command'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:628:in `check_is_master'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:402:in `connect'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:589:in `setup'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo-1.6.2/lib/mongo/connection.rb:114:in `initialize'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo_mapper-0.11.1/lib/mongo_mapper/connection.rb:75:in `new'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/mongo_mapper-0.11.1/lib/mongo_mapper/connection.rb:75:in `connect'
from /Users/Name/Projects/talker/config/initializers/mogo.rb:28:in `'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:588:in `block (2 levels) in '
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:587:in `each'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/engine.rb:587:in `block in '
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/Name/Projects/talker/config/environment.rb:12:in `'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:103:in `require'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:103:in `require_environment!'
from /Users/Name/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:25:in `'
from script/rails:6:in `require'
from script/rails:6:in `'
new-host:talker Name$
environment.rb
require File.expand_path('../application', FILE)
Talker::Application.initialize!
mongo.rb
MongoMapper.config = {
Rails.env => { 'uri' => ENV['MONGOHQ_URL'] || 'mongodb://localhost:28017' } }
MongoMapper.connect(Rails.env)
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
MongoMapper.connection.connect if forked
end
end
Your config file says to connect to localhost:28017, but that's the web console. You probably want localhost:27017.

Resources