Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a new project in rails older version

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?

like image 481
imran Avatar asked Feb 28 '12 09:02

imran


People also ask

How do I use a different version of rails?

There's nothing you need to do to manage two different Rails versions. The only thing you'll want to do is gem install rails to get the latest version and create your new project with rails new myapp . That will make sure the new project starts with Rails 5.1 (or whatever is the latest at the time).


2 Answers

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

like image 53
devudilip Avatar answered Oct 01 '22 12:10

devudilip


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
like image 20
Bernd May Avatar answered Oct 01 '22 12:10

Bernd May