Kuen
Kuen

Reputation: 163

Switching to rails 3

I want to switch into rails 3 and make my project use it as well. I installed gems, the output of gem list | grep rails is

rails (3.1.1)

in config/environment.rb it's indicated

RAILS_GEM_VERSION = '3.1.1' unless defined? RAILS_GEM_VERSION

but if i type rails -v it says Rails 2.3.2

when I try to run the server i get this

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- initializer (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./script/../config/boot.rb:56:in `load_initializer'
from ./script/../config/boot.rb:39:in `run'
from ./script/../config/boot.rb:12:in `boot!'
from ./script/../config/boot.rb:111
from ./script/server:2:in `require'
from ./script/server:2

If I try to make

rails _3.1.1_ --version

I get

/opt/ruby1.9/lib/ruby19/1.9.1/rubygems.rb:636:in `report_activate_error': RubyGem version error: rails(2.3.2 not = 3.1.1) (Gem::LoadError)
from /opt/ruby1.9/lib/ruby19/1.9.1/rubygems.rb:141:in `activate'
from /opt/ruby1.9/lib/ruby19/1.9.1/rubygems.rb:49:in `gem'
from /opt/ruby1.9/bin/rails:18:in `<main>

Does anyone know what i have to do with it?

Thanx

Upvotes: 1

Views: 145

Answers (2)

Arsen7
Arsen7

Reputation: 12840

I am sure you will soon receive some more valuable answers, but I would suggest you try to migrate your project by creating a new Rails 3 project, and then move all your models, controllers, views and tests from the old one to the new one.

I usually check what differs in the code created by generators in new Rails versions - you will often learn a new, nice techniques. It may be a tedious work, especially if your project is pretty big, but usually the results will be better than just automatic migration.

Upvotes: 1

Chris Kimpton
Chris Kimpton

Reputation: 5551

What steps have you followed so far to do the upgrade?

Have you got the upgrade book - might be worth the $12 investment - depending on the size of your app?

What gems are in your Gemfile - you do have one, right?

Is bundler installed?

Your environment seems to be confused about your Ruby version too - /opt/ruby1.9/lib/ruby19/1.9.1/ and /usr/local/lib/site_ruby/1.8 - it might be worth using something like rvm or rbenv to help manage/separate your gems and ruby versions.

If you are using 1.9 - 1.9.2 is probably the version to use, I think there are some issues with 1.9.1.

HTH, Chris

Upvotes: 0

Related Questions