Specify Rails version when creating a new application

I have been testing out Rails 3 beta4, but want to create a test
application in Rails 2.3.8.
So, i installed the Rails version that i wanted, sudo gem install rails
-v=2.3.8. Now when i try to create my application, using rails myTestApp
-v=2.3.8, I get the rails help screen. Looking over it, I can’t seem to
find the option to specify the version of rails that I want to target.


rails new APP_PATH [options]

-G, [–skip-git] # Skip Git ignores and keeps
-b, [–builder=BUILDER] # Path to an application builder (can be a
filesystem path or URL)
-r, [–ruby=PATH] # Path to the Ruby binary of your choice
# Default:
[–edge] # Setup the application with Gemfile
pointing to Rails repository
[–dev] # Setup the application with Gemfile
pointing to your Rails checkout
[–skip-gemfile] # Don’t create a Gemfile
-d, [–database=DATABASE] # Preconfigure for selected database
(options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
# Default: sqlite3
-O, [–skip-activerecord] # Skip ActiveRecord files
-J, [–skip-prototype] # Skip Prototype files
-T, [–skip-testunit] # Skip TestUnit files
-m, [–template=TEMPLATE] # Path to an application template (can be a
filesystem path or URL).

Runtime options:
-s, [–skip] # Skip files that already exist
-f, [–force] # Overwrite files that already exist
-p, [–pretend] # Run but do not make any changes
-q, [–quiet] # Supress status output

Rails options:
-v, [–version] # Show Rails version number and quit
-h, [–help] # Show this help message and quit

The ‘rails new’ command creates a new Rails application with a
directory structure and configuration at the path you specify.

rails new ~/Code/Ruby/weblog

This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.


rails 2.3.8 <app_name>


unfortunately I get the same results


While the suggestion of using rails _2.3.8_ <app_name> will probably
work, I would highly suggest using RVM gemsets to help segregate your
Rails3 beta apps from your Rails 2.3.8 stable apps. This way you can
have one environment with Rails3 and all of its dependencies and
another separate environment for Rails 2.3 and the libraries it needs.
You will be very happy with it down the road. It appears you already
have RVM installed, so it should be simple to get started. Check out
the docs at http://rvm.beginrescueend.com/gemsets/.

Good luck!

thanks for the reply. i’m going to have to dig deeper into using
RVM. it seems very powerful, and i’m not taking advantage of it.


Hum… that’s weird. I have a couple of ruby versions installed and
that works for me. Are you sure you have the other version installed?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs