I installed DJ via gem, version 2.0.7 for a rails 2 project.
I added
require 'delayed_job'
Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.max_attempts = 5
to an initializer.
When I try to .delay something I get
NameError (uninitialized constant Delayed::DelayProxy::Job):
/var/lib/gems/1.8/gems/delayed_job-2.0.7/lib/delayed/message_sending.rb:9:in `method_missing'
Any Ideas?
Tahnks and regards, Ph.
Related
Ok I'm not a pro at creating gems, but I tried my best and created this gem https://rubygems.org/gems/webpack_native/versions/0.2.0
This gem has generators and if I use it from the local folder (meaning the gem folder is in my computer) it works fine, if I type rails g in terminal it shows me the generators including my gem's generators
But using it from rubygems always give me an error uninitialized constant WebpackNative:
/home/mody/.rvm/gems/ruby-2.7.0#myapp/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant': uninitialized constant WebpackNative (NameError)
any thoughts on this?
I'm not sure how this happen but I get it to work after I installed devise gem and run
rails g
the output of the available generators shows up including my gem, and the generator itself is working.
In a project I was given a task to update all gems to stable. We were using rails 3.2.0 and some other gems. After updating to version 3.2.8 all tests crushed and I wa to fix them, the last error is ActionView::Template::Error: uninitialized constant Addressable. I have a file with
module URIHelpers
class << self
...
def parse_url(url)
Addressable.URI.heuristic_parse(url)
end
...
end
end
When calling URIHelpers.parse_url(url) I'm getting the above error. Where could be a error?
I've got an answer by myself :) I was to add
require 'addressable/uri'
at the begging of the file. Before the update it was required somewhere in dependent gems and after it was out and i needed to add it to gemfile by myself and require it by hand.
Trying to run the following using Rails 3.2.2, switched to 3.2.1 and tried another machine to see if it was more core / OS related.
I try:
rails g bootstrap:themed events
I get:
.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:229:in `const_defined?': wrong constant name event (NameError)
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:229:in `block in constantize'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:228:in `each'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/inflector/methods.rb:228:in `constantize'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
from /Users/charleyhine/.rvm/gems/ruby-1.9.3-p0/gems/twitter-bootstrap-rails-2.0.4/lib/generators/bootstrap/themed/themed_generator.rb:58:in `columns'
from (erb):6:in `template'
No need to downgrade the gem version. Instead, just change:
rails g bootstrap:themed events
to:
rails g bootstrap:themed Events
You need to capitalize and pluralize the model name, which is dumb, but it works
I was getting the same error. After searching for similar errors - I figured it must be a problem with the latest version of bootstrap, as I was not getting this error earlier.
I got the error with the version 2.0.4. The following line in the Gemfile followed by "bundle install" solved it for me.
gem 'twitter-bootstrap-rails', '2.0.2'
I have an application using Rails 2.3.4 which I'm trying to run. No matter how I start it, by using script/console or script/ferret_server, it always boils down to the same error:
uninitialized constant Gem
When I search online, I only find people who has a similar problem finding something inside of the Gem class. But in my case, Gem is just not there at all.
I am running Ruby on Ubuntu. I tried using the version of Ruby that came with APT and a more recent one with RVM. Nothing helped.
Any idea how what can be causing thing and how to fix it? Thanks in advance!
Some extra details, as requested by commenters:
Output of ruby -v:
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2011.03
Output of gem -v:
1.8.6
Calling ruby script/console outputs a similar error (edited):
Loading development environment (Rails 2.3.4)
/var/www/sites/example.com/releases/20110726061310/config/environment.rb:12:NameError: uninitialized constant Gem
/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/init.rb:254:in `require': no such file to load -- console_app (LoadError)
from /usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/init.rb:254:in `load_modules'
from /usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/init.rb:252:in `each'
from /usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/local/rvm/rubies/ree-1.8.7-2011.03/bin/irb:17
I'm trying to call Ferret Server to allow Passenger to connect to it, with the command:
ruby --debug script/ferret_server -e production start
Outputs the following error:
Exception `NameError' at ./script/../vendor/plugins/acts_as_ferret/lib/../../../../config/environment.rb:12 - uninitialized constant Gem
uninitialized constant Gem
Alternatively, calling bundle exec ruby --debug script/ferret_server -e production start outputs the following error:
superclass mismatch for class GemDependency
Please note that I added the following right above the Rails::Initializer.run do |config| line in config/environment.rb:
require 'thread'
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
r = super
(r == Gem::Requirement.default) ? nil : r
end
end
end
end
require File.join(File.dirname(__FILE__), 'boot')
Remove the lines mentioned above gives uninitialized constant Rails errors instead.
Try putting:
require 'rubygems'
Just after require 'thread'
I am trying to run the unit tests of the ActiveMerchant gem version
1.4.1: https://github.com/Shopify/active_merchant/tree/v1.4.1
First I ran: rake -T and got the error:
uninitialized constant ActiveMerchant::Validateable::HashWithIndifferentAccess
I fixed that first error by adding:
gem 'activesupport', "=2.3.4"
require 'active_support'
at the top of the Rakefile(https://github.com/Shopify/active_merchant/blob/v1.4.1/Rakefile). Note that I had to specify the exact version (I guess HashWithIndifferentAccess doesn't exist in later versions of ActiveSupport).
Now, if I run: rake test:units, I get the same error:
uninitialized constant ActiveMerchant::Validateable::HashWithIndifferentAccess
Here is the task that it tries to run (in the same Rakefile):
Rake::TestTask.new(:units) do |t|
t.pattern = 'test/unit/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.verbose = true
end
How can I get rid of this error? Do I need to specify the activesupport gem inside the task?
gem 'activemerchant' # => Ruby 1.9.2 / AM 1.12.x
vs
gem 'active_merchant' # => ? / AM 1.5.2
ActiveMerchant is on version 1.12.0, so 1.4.1 is quite old - have you tried this with the latest version?