mercredi 21 mai 2014

Créez un nouveau projet dans l'ancienne version de rails - Stack Overflow


I have rails version 3.2.1 in my machine. The other versions installed are 3.0, 3.0.3. Whenever i run


 rails new PROJECT_NAME

command ,the project gets created in version 3.2.1. I want to create the project in version 3.0.3.


What should i do?




Suggest using bundler. Your project will have a Gemfile in which you specify the rails version you want:


gem "rails", "~> 3.0.3"


Once you have installed the bundler gem, bundle install will install the version of Rails you have specified.


Then, when you are ready to upgrade your version of Rails, you do this by specifying the version number you want to move to. Of course, this approach helps manage all of the gems that your project depends on, including the ones you only want in test and dev etc.


See http://gembundler.com/ for more.




You could use something like RVM and install the other rails versions in a different gemset. Then select the gemset with an older rails version and your rails command should be from the older version.


Alternatively you should be able to use


rails _VERSION_ new myapp



you can create new app with older version


rails _3.0.3_ new appname 

but you may get error as


/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:inbin_path': can't find gem railties (["3.0.3"]) with executable rails (Gem::GemNotFoundException) from /usr/local/bin/rails:19:in'


so


again install rails gem


sudo gem install rails -v="3.0.3"

now you can do


rails _3.0.3_ new app

it will work fine


thank you



I have rails version 3.2.1 in my machine. The other versions installed are 3.0, 3.0.3. Whenever i run


 rails new PROJECT_NAME

command ,the project gets created in version 3.2.1. I want to create the project in version 3.0.3.


What should i do?



Suggest using bundler. Your project will have a Gemfile in which you specify the rails version you want:


gem "rails", "~> 3.0.3"


Once you have installed the bundler gem, bundle install will install the version of Rails you have specified.


Then, when you are ready to upgrade your version of Rails, you do this by specifying the version number you want to move to. Of course, this approach helps manage all of the gems that your project depends on, including the ones you only want in test and dev etc.


See http://gembundler.com/ for more.



You could use something like RVM and install the other rails versions in a different gemset. Then select the gemset with an older rails version and your rails command should be from the older version.


Alternatively you should be able to use


rails _VERSION_ new myapp


you can create new app with older version


rails _3.0.3_ new appname 

but you may get error as


/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:inbin_path': can't find gem railties (["3.0.3"]) with executable rails (Gem::GemNotFoundException) from /usr/local/bin/rails:19:in'


so


again install rails gem


sudo gem install rails -v="3.0.3"

now you can do


rails _3.0.3_ new app

it will work fine


thank you


0 commentaires:

Enregistrer un commentaire