ruby 2.7.1
rails 6.0.3
config/application.rb
# # for aurora failover bug
config.middleware.insert_before ActionDispatch::Executor,
ActiveRecord::ConnectionAdapters::ReconnectOnErrorManagement
then
rails c
I got
uninitialized constant ActiveRecord::ConnectionAdapters::ReconnectOnErrorManagement (NameError)
I have no idea.
Related
In the Gemfile, the gem is listed like this:
gem "faraday"
This leads to the installation of the current version 1.10.0.
Then, following this documentation, I create a custom logger, but I get an error:
NameError: uninitialized constant Faraday::Logging
Did you mean? Logger
If open the Rails console and write the code Faraday::Logging::Formatter there, the error will be exactly the same.
Tell me, please, what is the matter and how to fix it?
UPD.
If I write this in the Rails console:
Faraday::Response::Logger::Formatter
Then I get this error:
NameError: uninitialized constant Faraday::Response::Logger::Formatter
Then I write this:
Faraday::Logging::Formatter
And there are no more errors. What is going on?
bundle exec rails c
Faraday::Logging::Formatter
=> NameError: uninitialized constant Faraday::Logging
Faraday::Logging::Formatter
=> NameError: uninitialized constant Faraday::Logging
Faraday::Response::Logger::Formatter
=> NameError: uninitialized constant Faraday::Response::Logger::Formatter
Faraday::Logging::Formatter
=> Faraday::Logging::Formatter
I've added gem "webmock" and started having an error:
$ rspec
/home/me/.gem/ruby/2.3.1/gems/safe_yaml-1.0.1/lib/safe_yaml/syck_node_monkeypatch.rb:42:in `<top (required)>': uninitialized constant Syck (NameError)
I've tried includig this:
module SafeYAML
YAML_ENGINE = defined?(YAML::ENGINE) ? YAML::ENGINE.yamler : (defined?(Psych) && YAML == Psych ? "psych" : "syck")
end
into different initialization files such as application.rb and initializers/my_init.rb, but it didn't help to fix the error. How can I fix it?
I am getting following error while executing environment.rb
C:\RailsProject>jruby script/delayed_job start
NameError: uninitialized constant RAILS_ROOT
const_missing at org/jruby/RubyModule.java:2647
(root) at C:/RailsProject/config/environment.rb:20
require at org/jruby/RubyKernel.java:1062
(root) at script/delayed_job:3
environment.rb contains following code
# Be sure to restart your server when you modify this file
require "rubygems"
require 'memcache'
if ENV['LOCAL'] == 'Y'
require "bundler/setup"
end
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['Rails.env'] = 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '3.2.13' unless defined? RAILS_GEM_VERSION
ENABLE_FACEBOOK = false
# Bootstrap the Rails environment, frameworks, and default configuration
Dir["#{Rails.root}/lib/integration/*.rb"].each do | file|
require file
end
# Initialize the rails application
RailsProject::Application.initialize!
I am using rails 3.2.13 version.
Could you please help me on this?
I'm updating the code for a generator that I wrote, but has been working fine until now.
When I simply rue the command
bundle exec rails g
I get the following error
/Users/mpierc200/projects/prototype_conflux/vendor/gems/itrc_client_files_generator-1.0.13/lib/itrc_client_files_generator.rb:6:in `<top (required)>':
uninitialized constant Rails::Generators (NameError)
The offending line is
class ItrcClientFilesGenerator < Rails::Generators::Base
My Rails version is
Rails 3.1.9
ruby version is
ruby 1.9.3p194
It looks like the Rails generator modules were pulled out and not automatically loaded at some point during Rails 3 development. This is probably for good reasons.
You have to include them in custom generators:
require 'rails/generators'
class ItrcClientFilesGenerator < Rails::Generators::Base
# Fancy generator code here
end
The deep_cloning gem is causing this error:
NameError: uninitialized constant %{AnyModel}
When I do bundle update, it tells me this:
deep_cloning at /Users/me! =D/.rvm/gems/ruby-1.8.7-p352#secret_gemset/bundler/gems/deep_cloning-423f1e30eeef did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
["deep_cloning-0.2.0.gem"] are not files
What am I doing wrong here?
In my Gemfile I specify the path to the gem like so:
gem "deep_cloning", :git => "git://github.com/DerNalia/deep_cloning.git"
Update: the stacktrace from the unitialized constant error:
> MyModel.find(455)
NameError: uninitialized constant MyModel
from /rvm_gemset_path/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:443:in `load_missing_constant'
from /rvm_gemset_path/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `rake_original_const_missing'
from /rvm_gemset_path/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
from /rvm_gemset_path/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing'
from (irb):1
You should remove the line :
s.files = [
...
"deep_cloning-0.2.0.gem"
...
]
from your gemspec.