views:

81

answers:

5

I typed this:

>rails console

and got this:

Usage:
  rails new APP_PATH [options]

Options:
      [--skip-gemfile]        # Don't create a Gemfile
  -d, [--database=DATABASE]   # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db)
                              # Default: sqlite3
..
..
.

I'm following along the rails tutorial and got stuck on this.

I have rails 3.0 installed.

A: 

are you in a rails 3 app directory?

do you have multiple versions of rails installed?

try checking 'which rails', and make sure this is a rails 3 executable you are running - that usage looks like rails 2.x.

Andrew Kuklewicz
which rails => /usr/bin/rails
Blankman
rails -v => Rails 3.0.0
Blankman
A: 

In Rails 2.3.x the command is script/console within a given Rails application directory to start a Ruby console with the default Rails environment loaded into memory. Not sure if Rails 3.0 is the same or not.

Richard Cook
+2  A: 

Are you in the root path of your app when you type $ rails console?

Tip: $ rails c is a shortcut for $ rails console

Yannis
no I wasn't, but it works when I am, why is that? rails -v works outside the root path of the app.
Blankman
`rails` is a system-wide available program. You use it to set up your environment using `rails new <projectname>`. In order to use rails commands specific to your application (like running the console), you have to tell it where to work - ie. running inside the project root.
eli
A: 

You are running the correct command (rails console), but you are most likely not in the working directory for this application. Change directory to the root of your rails application (beneath which you will find /scripts, /app, etc.), and the command should work as desired.

Note: Using script/console or ruby script/console is for earlier versions of Rails.

eli
A: 

You need to into the project directory and command rails console eg:

D:\workspace\>rails blog
D:\workspace\>cd blog
D:\workspace\blog\> rails c
loading en...
kenny