在rails旧版本中创建一个新项目

时间:2022-01-18 10:54:37

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

我的机器上有导轨版本3.2.1。安装的其他版本是3.0,3.0.3。每当我跑步

 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.

命令,项目在版本3.2.1中创建。我想在3.0.3版本中创建项目。

What should i do?

我该怎么办?

3 个解决方案

#1


3  

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

建议使用bundler。您的项目将有一个Gemfile,您可以在其中指定所需的rails版本:

gem "rails", "~> 3.0.3"

宝石“rails”,“〜> 3.0.3”

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

一旦安装了bundler gem,bundle install就会安装你指定的Rails版本。

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.

然后,当您准备升级Rails版本时,可以通过指定要移动到的版本号来执行此操作。当然,这种方法有助于管理项目所依赖的所有宝石,包括您在测试和开发中仅需要的宝石等。

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

有关更多信息,请访问http://gembundler.com/。

#2


23  

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'

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:inbin_path':找不到来自/的可执行rails(Gem :: GemNotFoundException)的gem railties([“3.0.3”]) USR / local / bin目录/导轨:19:

so

所以

again install rails gem

再次安装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

谢谢

#3


11  

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.

您可以使用类似RVM的东西,并在其他gemset中安装其他rails版本。然后选择具有较旧rails版本的gemset,并且rails命令应该来自旧版本。

Alternatively you should be able to use

或者你应该可以使用

rails _VERSION_ new myapp

#1


3  

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

建议使用bundler。您的项目将有一个Gemfile,您可以在其中指定所需的rails版本:

gem "rails", "~> 3.0.3"

宝石“rails”,“〜> 3.0.3”

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

一旦安装了bundler gem,bundle install就会安装你指定的Rails版本。

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.

然后,当您准备升级Rails版本时,可以通过指定要移动到的版本号来执行此操作。当然,这种方法有助于管理项目所依赖的所有宝石,包括您在测试和开发中仅需要的宝石等。

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

有关更多信息,请访问http://gembundler.com/。

#2


23  

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'

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:inbin_path':找不到来自/的可执行rails(Gem :: GemNotFoundException)的gem railties([“3.0.3”]) USR / local / bin目录/导轨:19:

so

所以

again install rails gem

再次安装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

谢谢

#3


11  

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.

您可以使用类似RVM的东西,并在其他gemset中安装其他rails版本。然后选择具有较旧rails版本的gemset,并且rails命令应该来自旧版本。

Alternatively you should be able to use

或者你应该可以使用

rails _VERSION_ new myapp