Rails application starts with wrong rails version
I'm trying to upgrade a Rails 2 application to Rails 3.
rails -v
outputs Rails 3.0.0.rc -- so, that part's good.
But...
When I do:
rails server
I just get the help
So I tried
script/server
and I get:
=> Booting WEBrick
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
I've done a global replace in the application on '2.3.2' but it STILL says it's a 2.3.2 application! Why is that???
I've followed a bunch of tutorials on this upgrade path and no luck yet. But I'm really stumped as to what keeps making it thin开发者_如何学Gok it's a 2.3.2 application.
Rails 3 requires using Bundler for package management (including Rails version), so simply replacing 2.3.2 will not work. Furthermore, the Mongrel server is now started using 'rails server' (instead of script/server).
I recommend you take a look at Ryan Bate's screencasts on upgrading from Rails 2 to Rails 3 (very well done). You can find them on Rails Casts as #225, #226 and #227.
Your config/environment.rb file is what sets the particular version of rails that your app is running, with the following line:
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
However, the process of upgrading to Rails 3 is much more involved. You will need to start by installing the rails_upgrade plugin and then running a few commands to migrate some key files across. The instructions for the upgrade procedure are all here: http://github.com/rails/rails_upgrade/blob/master/install.rb
Just to make sure it's found if someone else comes along -- I had to unfreeze my application. It was automatically using the rails version frozen into the app.
精彩评论