Error in Ruby on Rails on Ubuntu 14.04 - ruby-on-rails

When I run rails c I get an error:
/usr/lib/ruby/vendor_ruby/active_support/test_case.rb:12:in `<module:ActiveSupport>': uninitialized constant Test::Unit::TestCase (NameError)
Please help me to fix this error.

Add require 'test/unit'
at the beginning of
/usr/lib/ruby/vendor_ruby/active_support/test_case.rb

Related

uninitialized constant YAML::ENGINE error

I am getting this error uninitialized constant YAML::ENGINE error when i run rake db:migrate . I have the ruby version ruby 1.9.3p327 and rails version Rails 3.0.20, my gems version is 1.8.25. can anyone please help that whats wrong.
this is how my config/boot.rb file looks like
require 'yaml'
YAML::ENGINE.yamler= 'syck'
on this second line I am getting this error.

Updating from Rails 3.2.0 to 3.2.8 caused uninitialized constant Addressable

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.

"uninitialized constant Gem" or "Rails" when starting Rails 2 app

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'm getting this error: uninitialized constant YAML::ENGINE (NameError)

i have the code belowin the environment.rb and i keep getting the error uninitialized constant YAML::ENGINE (NameError) when i try to run it.
environment.rb
require 'yaml'
YAML::ENGINE.yamler= 'syck'
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Quora::Application.initialize!
anybody have an idea?
YAML::ENGINE doesn't exist in Ruby 1.8.7. This is defined in Ruby 1.9. I tried running irb on 1.8.7 and 1.9.2. Strange though, both of their YAML version number is the same (0.6.0).
Also, I think Ruby 1.8.7's YAML already uses SYCK for yaml parsing. :)

Dragonfly question

I tried switching from gem rails 3.0.0.rc to rails 3.0.0 in my Gemfile recently and when doing so I got a problem with Dragonfly when starting the server. The error message says:
/Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing': uninitialized constant Dragonfly::Config::HerokuRailsImages (NameError)
from /Users/erikostling/Spatziba/config/initializers/dragonfly.rb:4
Switching back to RC doesn't help. Does anyone have an idea on what is wrong?
My dragonfly.rb looks like this:
require "dragonfly"
app = Dragonfly::App[:images]
app.configure_with(Dragonfly::Config::HerokuRailsImages, "static.my-app-domain.com")
app.parameters.default_format = :jpg
Dragonfly.active_record_macro(:image, app)
Any help would be greatly appreciated!
E
Make sure to follow this Rails 3 installation instructions.

Resources