Rails console not working with my application

Hi I have couple of issues with my application. I have an app checked
out from a repository on to my local machine. rake commands like rake
db:create and rake db:migrate and gem list, gem install are working with
the app but not any other commands like rails generate scaffold User
username:string, rails server, rails console…

following is the error

Usage:
rails new APP_PATH [options]

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

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

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

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

Example:
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.

Sawan T. wrote in post #972924:

Hi I have couple of issues with my application. I have an app checked
out from a repository on to my local machine. rake commands like rake
db:create and rake db:migrate and gem list, gem install are working with
the app but not any other commands like rails generate scaffold User
username:string, rails server, rails console…

following is the error

Usage:
rails new APP_PATH [options]

Hmm. Is the app Rails 3 or Rails 2? If you don’t know, try going to
the app root directory and typing script/about (at least, this works for
Rails 2 apps).

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote in post #972926:

Sawan T. wrote in post #972924:

Hi I have couple of issues with my application. I have an app checked
out from a repository on to my local machine. rake commands like rake
db:create and rake db:migrate and gem list, gem install are working with
the app but not any other commands like rails generate scaffold User
username:string, rails server, rails console…

following is the error

Usage:
rails new APP_PATH [options]

Hmm. Is the app Rails 3 or Rails 2? If you don’t know, try going to
the app root directory and typing script/about (at least, this works for
Rails 2 apps).

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

“Hi Marnen thanks for the reply. I know the application version is 2.3.5
and it is mentioned in my environment.rb file and even when I tried to
do as you said"app root directory and typing script/about” it did not do
anything but gave the same error message like previous. I forgot to tell
you that I’m working on windows machine… its weird because applications
I have created on my local machine using rails new myapp works and all
the other commands work with myapp… I can create new controller new
model or even add a column to the existing migration table etc…"

Sawan T. wrote in post #972932:

Marnen Laibow-Koser wrote in post #972926:

Sawan T. wrote in post #972924:

Hi I have couple of issues with my application. I have an app checked
out from a repository on to my local machine. rake commands like rake
db:create and rake db:migrate and gem list, gem install are working with
the app but not any other commands like rails generate scaffold User
username:string, rails server, rails console…

following is the error

Usage:
rails new APP_PATH [options]

Hmm. Is the app Rails 3 or Rails 2? If you don’t know, try going to
the app root directory and typing script/about (at least, this works for
Rails 2 apps).

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

"Hi Marnen thanks for the reply. I know the application version is 2.3.5
and it is mentioned in my environment.rb file

Then there’s your problem. The syntax of the rails command changed
between versions 2 and 3. The usage message you provided comes from
version 3. So…you’ve got Rails 3’s command-line script, and a Rails 2
application. Do you have the Rails 2.3.5 gem available at all? (Check
gem list rails and the vendor/rails directory in your app.)

and even when I tried to
do as you said"app root directory and typing script/about" it did not do
anything but gave the same error message like previous. I forgot to tell
you that I’m working on windows machine…

That’s a problem right there. If you can work on a Mac or other *nix
box, do. If not, download Virtual Rails.

And I highly recommend using RVM (if you’re on *nix) to give this
application its own gemset. (If you must work on Windows, I
understand pik is similar.)

its weird because applications
I have created on my local machine using rails new myapp works and all
the other commands work with myapp… I can create new controller new
model or even add a column to the existing migration table etc…"

Right. Because those are Rails 3 apps.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On 6 January 2011 20:55, Sawan T. [email protected] wrote:

Usage:
[email protected]

“Hi Marnen thanks for the reply. I know the application version is 2.3.5
and it is mentioned in my environment.rb file and even when I tried to
do as you said"app root directory and typing script/about” it did not do
anything but gave the same error message like previous. I forgot to tell
you that I’m working on windows machine… its weird because applications
I have created on my local machine using rails new myapp works and all
the other commands work with myapp… I can create new controller new
model or even add a column to the existing migration table etc…"

Have you installed rails 2.3.5? gem list should show you which
versions you have installed.

Colin

On Jan 6, 2011, at 5:01 PM, Sawan T. wrote:

Thanks
Sawan."

I believe you can always force a particular version of rails at the
command line by using this syntax:

rails_2.3.5 script/whatever

But the smart money is on RVM.

Walter

Marnen Laibow-Koser wrote in post #972937:

Sawan T. wrote in post #972932:

Marnen Laibow-Koser wrote in post #972926:

Sawan T. wrote in post #972924:

Hi I have couple of issues with my application. I have an app checked
out from a repository on to my local machine. rake commands like rake
db:create and rake db:migrate and gem list, gem install are working with
the app but not any other commands like rails generate scaffold User
username:string, rails server, rails console…

following is the error

Then there’s your problem. The syntax of the rails command changed

between versions 2 and 3. The usage message you provided comes from
version 3. So…you’ve got Rails 3’s command-line script, and a Rails 2
application. Do you have the Rails 2.3.5 gem available at all? (Check
gem list rails and the vendor/rails directory in your app.)

That’s a problem right there. If you can work on a Mac or other *nix
box, do. If not, download Virtual Rails.

And I highly recommend using RVM (if you’re on *nix) to give this
application its own gemset. (If you must work on Windows, I
understand pik is similar.)

its weird because applications
I have created on my local machine using rails new myapp works and all
the other commands work with myapp… I can create new controller new
model or even add a column to the existing migration table etc…"

Right. Because those are Rails 3 apps.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

"I have gem list rails showing me 3.0.3, 3.0.0 and 2.3.5 is it anything
to do with your app_config.rb and I dont see any in vendor/rails its all
have some plugin folders. I am working with tutorials which needed those
rails version and 2.3.5 since my app needs it. I think the rails version
will render to the needed

Thanks
Sawan."

Walter D. wrote in post #972969:

On Jan 6, 2011, at 5:01 PM, Sawan T. wrote:

Thanks
Sawan."

I believe you can always force a particular version of rails at the
command line by using this syntax:

rails_2.3.5 script/whatever

Actually, that’s rails 2.3.5 whatever other arguments. But that won’t
make a difference here: Rails 2 doesn’t have all the script/* stuff
subsumed under the rails command the way Rails 3 does.

But the smart money is on RVM.

Walter

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On 6 January 2011 22:33, Sawan T. [email protected] wrote:

rails_2.3.5 script/whatever

But the smart money is on RVM.

Walter

Thanks Walter for your reply, I used the syntax rails_2.3.5
script/console nothing happened. Then I tried to see the rails version
by using rails -v and it gave me 3.0.3… is there anyway that I can
have the app use verson 2.3.5

I absolutely agree with another poster who said you should use rvm
(Ruby Version Manager). This lets you separate out the sets of gems
(including Rails) that an app should use so that it is not confused by
other versions of gems on the system.

Colin

Walter D. wrote in post #972969:

On Jan 6, 2011, at 5:01 PM, Sawan T. wrote:

Thanks
Sawan."

I believe you can always force a particular version of rails at the
command line by using this syntax:

rails_2.3.5 script/whatever

But the smart money is on RVM.

Walter

Thanks Walter for your reply, I used the syntax rails_2.3.5
script/console nothing happened. Then I tried to see the rails version
by using rails -v and it gave me 3.0.3… is there anyway that I can
have the app use verson 2.3.5

Colin L. wrote in post #973049:

On 6 January 2011 22:33, Sawan T. [email protected] wrote:

rails_2.3.5 script/whatever

But the smart money is on RVM.

Walter

Thanks Walter for your reply, I used the syntax rails_2.3.5
script/console nothing happened. Then I tried to see the rails version
by using rails -v and it gave me 3.0.3… is there anyway that I can
have the app use verson 2.3.5

I absolutely agree with another poster who said you should use rvm
(Ruby Version Manager). This lets you separate out the sets of gems
(including Rails) that an app should use so that it is not confused by
other versions of gems on the system.

Colin

"Hi Everyone… I appreciate everyone for helping me out in this issue. I
was googling and found that the rails version in the application is
2.3.5 will use the syntax “ruby script\console”… Walter was close to
help me out on this but instead of rails script\whatever its ruby
script\whatever… I had to deal with another issue as the
script\console.rb file in the app script folder was not being found and
this is because the file console.rb line 2 should be changed from
require File.dirname(FILE) + ‘/…/config/boot’ to
require File.expand_path(‘…/…/config/boot’, FILE)… should be same
with the server.rb too. In order to run or start the server on your
local
use ruby script\server webrick for webrick server or ruby script\server
mongrel…
Thanks,
Sawan "