Upgrading my application from rails 2.3.5 to rails 3.1.0

when try to run my application i got
Missing the Rails 3.1.0 gem. Please gem install -v=3.1.0 rails, update
your RAILS_GEM_VERSION setting in config/environment.rb for the Rails
version you do have installed, or comment out RAILS_GEM_VERSION to use
the latest version installed.

Open environment.rb and check the rails version there, if its 3.1.0 then
gem install it, else 2.3.5, for upgrading you have to upgrade it to
2.3.10 first make few changes in code then 3.0 nd so on.