2

I installed Ruby 1.9.3 and Rails (rubygems-1.8.24) successfully on Windows 7.

Now I need to generate a 'controller home index' on command prompt. I created a project folder called 'rails-projects' and successfully created a project called 'quizzes-on-rails'.

At:

C:\rails-projects\quizzes-on-rails

I type:

ruby script/generate controller home index

And I get the following message:

ruby: No such file or directory -- script/generate <LoadError>

I edited PATH by including C:\rails-projects\quizzes-on-rails

Any idea what is wrong?

1
  • script/generate sounds like you are reading an old tutorial for rails 1 or 2. Be sure to focus on version 3 or 4, there's no need to be learning the old methods. :) Commented Dec 22, 2013 at 4:15

2 Answers 2

6

Start cmd prompt with rails or open the rails command prompt and run:

rails g controller Foo home index
Sign up to request clarification or add additional context in comments.

Comments

3

You can use:

rails g controller <ControllerName> [valid actions]

e.g.:

rails g controller Posts index show destroy

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.