Unable to run rake after updating rails versions - ruby-on-rails

I have upgraded to rails 2.3.11 and and ruby 1.9.2 as some of my gems were incompatible with previous version. Now I am unable to execute rake command. I am getting following error when i do rake gems:install or rake db:migrate.
(in C:/Ruby/New/Facebook)
rake aborted!
can't convert Symbol into Integer
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/rails/gem_dependency.rb:53:
in `[]'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/rails/gem_dependency.rb:53:
in `initialize'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:836:in `new'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:836:in `gem'
C:/Ruby/New/Facebook/config/environment.rb:22:in `block in <top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:111:in `run'
C:/Ruby/New/Facebook/config/environment.rb:9:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/depe
ndencies.rb:182:in `block in require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/depe
ndencies.rb:547:in `new_constants_in'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/depe
ndencies.rb:182:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/tasks/misc.rake:4:in `block
in <top (required)>'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `call'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `each'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `execute'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:602:in `each'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:581:in `invoke'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run'
C:/Ruby192/bin/rake:31:in `<main>'
Please help me as I am stuck on it for few days.

Looks like a Rake version issue to me. Try this...
gem uninstall rake # select all options
gem 'rake', '0.8.7' # Gemfile
bundle install
run you rake command
Placing this line of code in your .rvmrc in your root directory will allow you to skip little error like this in the future.
bundle exec $SHELL
All the best, let us know how you get on.

It's possible that you need to upgrade rubygems-update.
Run gem -v to see your current version number.
Run gem update --system to upgrade rubygems. (you may need to sudo depending on your setup)
To revert to your previous version, run gem update --system 1.3.7 (swap 1.3.7 for the previous version number)

You are suppose to resolve the conflicts of gems befre initiate rake. try running server if you get succeeded it means you can run Rake as well it has nothing to do with Rake version befre running rake make a valid gem list for rails.

Related

rails 2.2 with ruby 1.9.2 undefined method `source_index' for Gem:Module

I am try to setup the development env for my rails 2 application using ruby 1.9.2.
While I am giving rake db:create command I got the following error.
I also change the version to 1.8.7 then also getting the same error
rake aborted!
undefined method `source_index' for Gem:Module
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/initializer.rb:273:in `add_gem_load_paths'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/initializer.rb:131:in `process'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/initializer.rb:112:in `run'
/home/dharin/rails_projects/hesistudy_dev/config/environment.rb:24:in `<top (required)>'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `block in require'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/home/dharin/.rvm/gems/ruby-1.9.2-p320/gems/rails-2.2.2/lib/tasks/misc.rake:3:in `block in <top (required)>'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:634:in `call'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:629:in `each'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:629:in `execute'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:602:in `each'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:581:in `invoke'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2019:in `each'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/rake.rb:1992:in `run'
/home/dharin/.rvm/rubies/ruby-1.9.2-p320/bin/rake:31:in `<main>'
Ruby 1.9.2 isn't that new, you should use 1.9.3-p448. Rubygems 1.8.25 is very old, and should be used with Ruby 1.8 only AFAIK. You are probably using a very old distro. Try using rvm to install the latest Ruby 1.9 and Rubygems. Here's a brief quick-start guide. Refer to the docs in case of troubles.
\curl -L https://get.rvm.io | bash -s stable
rvm install 1.9
rvm use 1.9 --default
rvm rubygems latest --verify-downloads 1
gem install bundler
bundle exec ./script/server

Deploy Rails 2.3.16 application on Heroku, try to migrate database, rake aborted! cannot load such file -- iconv

I am trying to deploy a copy of a Rails 2.3.16 application on Heroku. I pushed the application, and added a PostgreSQL database.
heroku run rake db:migrate
rake aborted!
cannot load such file --iconv
Apparently all new applications will run in ruby 2.0.0, and I have been having a lot of trouble managing versions recently. The old applications run in whatever version they were, which is 1.9.2. Maybe that is related. I looked for a long time, and found things such as:
Ruby 2.0 iconv replacement
in `require': no such file to load -- iconv (LoadError)
I tried gem install iconv
This site doesn't help, or maybe I don't understand what to do:
https://rvm.io/packages/iconv
rvm autolibs rvm_pkg did nothing. rvm autolibs enable didn't help.
This site seemed to say something completely different even though it linked to https://rvm.io/packages/iconv:
http://bullrico.com/2012/09/04/cannot-load-such-file-iconv/
I did:
rvm reinstall 1.9.2-p290 --with-iconv-dir=$rvm_path/usr
At least 2 things failed in that, and iconv issue is not resolved:
Error running 'env GEM_PATH=/Users/RedApple/.rvm/gems/ruby-1.9.2-p290:/Users/RedApple/.rvm/gems/ruby-1.9.2-p290#global:/Users/RedApple/.rvm/gems/ruby-1.9.2-p290:/Users/RedApple/.rvm/gems/ruby-1.9.2-p290#global GEM_HOME=/Users/RedApple/.rvm/gems/ruby-1.9.2-p290 /Users/RedApple/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -d /Users/RedApple/.rvm/src/rubygems-2.1.4/setup.rb',
please read /Users/RedApple/.rvm/log/1379705294_ruby-1.9.2-p290/rubygems.install.log
Installation of rubygems did not complete successfully.
Error running '__rvm_with ruby-1.9.2-p290 /Users/RedApple/.rvm/scripts/gemsets pristine',
please read /Users/RedApple/.rvm/log/1379705294_ruby-1.9.2-p290/gemset.pristine-ruby-1.9.2-p290.log
heroku run rake db:migrate
rake aborted!
cannot load such file -- iconv
I don't have time to reprogram the 2.3.16 application into 3 or 4 if that is required. I don't even know what iconv is. What is the easiest way to get rid of this error?
Edit:
I put this in the Gemfile and redeployed:
ruby '1.9.2'
I don't know if it is progress, but now a new error:
heroku run rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
bad URI(is not URI?):
/app/vendor/ruby-1.9.2/lib/ruby/1.9.1/uri/common.rb:156:in `split'
/app/vendor/ruby-1.9.2/lib/ruby/1.9.1/uri/common.rb:174:in `parse'
/app/vendor/ruby-1.9.2/lib/ruby/1.9.1/uri/common.rb:628:in `parse'
/app/config/initializers/redis.rb:1:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.16/lib/active_support/dependencies.rb:173:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.16/lib/active_support/dependencies.rb:173:in `load_with_new_constant_marking'
/app/vendor/bundle/ruby/1.9.1/gems/rails-2.3.16/lib/initializer.rb:622:in `block in load_application_initializers'
/app/vendor/bundle/ruby/1.9.1/gems/rails-2.3.16/lib/initializer.rb:621:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rails-2.3.16/lib/initializer.rb:621:in `load_application_initializers'
/app/vendor/bundle/ruby/1.9.1/gems/rails-2.3.16/lib/initializer.rb:176:in `process'
/app/vendor/bundle/ruby/1.9.1/gems/rails-2.3.16/lib/initializer.rb:113:in `run'
/app/config/environment.rb:11:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.16/lib/active_support/dependencies.rb:182:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.16/lib/active_support/dependencies.rb:182:in `block in require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.16/lib/active_support/dependencies.rb:547:in `new_constants_in'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.16/lib/active_support/dependencies.rb:182:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/rails-2.3.16/lib/tasks/misc.rake:4:in `block in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/app/vendor/ruby-1.9.2/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/app/vendor/ruby-1.9.2/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Edit:
I didn't read the error message thoroughly, and missed this line:
/app/config/initializers/redis.rb:1:in `<top (required)>'
I commented out these lines, since I don't need Redis yet:
# uri = URI.parse( ENV[ "REDISTOGO_URL" ] )
# REDIS = Redis.new( :host => uri.host, :port => uri.port, :password => uri.password )
heroku run rake db:migrate finally worked.
All of that, and it seems the main problem was solved by adding this line to the Gemfile:
ruby '1.9.2'
Lesson learned: If you have an old application that needs to be redeployed for some other purpose on Heroku, you need to specify the ruby version in the Gemfile.

Why is my rake call causing an 'undefined method `source_index`' error?

I am trying to run bundle exec rake db:migrate then encountered the following error.
bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `source_index' for Gem:Module
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/initializer.rb:298:in `add_gem_load_paths'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/initializer.rb:132:in `process'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/initializer.rb:113:in `run'
C:/Program Files/chiliproject-3.7.0/config/environment.rb:42:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `block in require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:547:in `new_constants_in'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:182:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/tasks/misc.rake:4:in `block in <top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:187:in `block in invoke_prerequisites'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:185:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:185:in `invoke_prerequisites'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
C:/Ruby193/bin/rake:23:in `load'
C:/Ruby193/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate => environment
This is the part encountering the error:
def self.add_frozen_gem_path
##paths_loaded ||= begin
source_index = Rails::VendorGemSourceIndex.new(Gem.source_index)
Gem.clear_paths
Gem.source_index = source_index
# loaded before us - we can't change them, so mark them
Gem.loaded_specs.each do |name, spec|
##framework_gems[name] = spec
end
true
end
end
I know this seems to be basic, but I have been searching over the internet and can't seem to find the answer.
the problem is perfectly solved undefined method `source_index' for Gem:Module (NoMethodError) with only simple row
gem update --system 1.8.25
Ok Ive been messing with this all day and finally got things working for me with the following:
Bring RVM up-to-date
rvm get head
Change ruby version to 1.9.3
Update in Gemfile
Update .rvmrc file
Update Rails to latest 2.3 version
Update in Gemfile
Update in environments.rb
Did all that then ran
bundle exec rake db:migrate
There is some wierd conflict happening in Rails 2.3 with the latest ruby gems and an unknown x factor, which could include an issue in ruby 1.9.1 and 1.9.2?
From ApiDock:
This class is deprecated or moved on the latest stable version. The
last existing version (v2.3.8) is shown here.
In the question, Rails version 2.3.17 is used and because of being deprecated, it gives an error. If it was 2.3.8, it could be worked.
This: undefined method `source_index' for Gem:Module (NoMethodError)
says
Gem.source_index has been deprecated for a while, but since Rails 2.3
is not getting any updates except critical security patches, this will
never get fixed. RubyGems v2.0 finally removed that method. Downgrade
to any rubygems version prior to 2.0.0, like 1.8.25 to get the
functionality back for now.
So my guess right now is it's something to do with Rails 2.3 conflicting with the current RubyGems.
I did this:
gem install rubygems-update -v '1.8.25'
gem uninstall rubygems-update # and just removed the other versions.
Didn't make a difference, but just sharing my findings.
Update you gem to 1.8.25
gem update --system 1.8.25
This may help you.

Getting undefined method `name' for "actionmailer":String when installing Webistrano

When I try and run a RAKE on Webistrano I get the following error:
undefined method `name' for "actionmailer":String`
I am a not proficient in Ruby and RoR but I have installed and played about with plenty of applications before and I can't find what the issue is.
The command I am running is:
RAILS_ENV=production rake db:migrate --trace
Which produces the below:
I would really like to know the best way to diagnose and fix this issue and issues like it in the future.
(in /srv/www/webistrano)
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `name' for "actionmailer":String
/srv/www/webistrano/vendor/rails/railties/lib/rails/gem_dependency.rb:268:in `=='
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:217:in `==='
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:217:in `block in matching_specs'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:411:in `block in each'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:410:in `each'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:410:in `each'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:216:in `find_all'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:216:in `matching_specs'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:238:in `to_specs'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
/srv/www/webistrano/vendor/rails/railties/lib/rails/gem_dependency.rb:73:in `add_load_paths'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:301:in `block in add_gem_load_paths'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:301:in `each'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:301:in `add_gem_load_paths'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:132:in `process'
/srv/www/webistrano/vendor/rails/railties/lib/initializer.rb:113:in `run'
/srv/www/webistrano/config/environment.rb:16:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/srv/www/webistrano/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `block in require'
/srv/www/webistrano/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/srv/www/webistrano/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
/srv/www/webistrano/vendor/rails/railties/lib/tasks/misc.rake:4:in `block in <top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate => environment
When I run ruby -v I get the following:
ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
I had this problem.
The solution is to downgrade rubygems to a version you support.
I needed version 1.3.5 (for rails 2.3.5)
So you need to do:
gem install rubygems-update -v 1.3.5
update_rubygems --version=1.3.5
And now rake should work.
This worked for me.
rvm rubygems 1.6.2

Ruby on Rails mysql2 adapter problem

I have installed ruby and rails and my application gives me an error when I am trying to run
rake db:migrate
this is the result of the command rake db:migrate --trace
** Execute db:migrate
rake aborted!
!!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/mysql_adapter.rb:22:in `rescue in mysql_connection'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/mysql_adapter.rb:19:in `mysql_connection'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `new_connection'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:237:in `checkout_new_connection'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:191:in `block (2 levels) in checkout'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:187:in `loop'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:187:in `block in checkout'
/usr/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in `checkout'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:94:in `connection'
/usr/lib/ruby/gems/1.9.1/gems/ar-octopus-0.3.4/lib/octopus/proxy.rb:83:in `select_connection'
/usr/lib/ruby/gems/1.9.1/gems/ar-octopus-0.3.4/lib/octopus/proxy.rb:177:in `send_queries_to_selected_slave'
/usr/lib/ruby/gems/1.9.1/gems/ar-octopus-0.3.4/lib/octopus/proxy.rb:140:in `method_missing'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:454:in `get_all_versions'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:583:in `migrated'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:492:in `current_version'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:509:in `block in migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:509:in `each'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:509:in `detect'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:509:in `migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:433:in `up'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/migration.rb:415:in `migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/railties/databases.rake:142:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/usr/bin/rake:19:in `load'
/usr/bin/rake:19:in `<main>'
confiz#confiz-desktop:~/mango_apps/rails_app_sms$ .
bash: .: filename argument required
.: usage: . filename [arguments]
I have already mentioned gem in my gemfile and already executed bundle install.
My database.yml file already has the correct adapter i.e. adapter: mysql2
Please help me resolve this problem.
I find the same problem if I use mysql2 v 0.2.19b4 in my Gemfile. If I use the latest mysql2 this conflicts with rails 3.0.17 which is dictated by Hobo (which generated my Gemfile). The warning I get from that is:
This version of mysql2 (0.3.11) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1. Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
Going back to mysql2 v 0.2.x The original load error comes because the rails mysql_adapter calls require 'mysql' not require 'mysql2'.
The solution is to use gem 'mysql' not gem 'mysql2' in the Gemfile
In my case bundler users gem mysql v 2.8.1 and everything works fine.

Resources