# Creating a Controller

**URL:** <https://www.ruby-forum.com/t/creating-a-controller/132943>\
**Category:** Rails\
**Created:** [March 25, 2008, 11:53pm UTC](https://www.ruby-forum.com/t/creating-a-controller/132943 "2008-03-25T23:53:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cz231](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/839c29/32.png) [@cz231](https://www.ruby-forum.com/u/cz231)\
**Post date:** [March 25, 2008, 11:53pm UTC](https://www.ruby-forum.com/t/creating-a-controller/132943/1 "2008-03-25T23:53:45Z")

</div>

Hi,  
I’m new to ruby on rails, but let me let you know, I’m very excited  
about learning it. Anyway, I’m trying to create a controller through  
the console but something makes it not work. I am running windows  
vista and using Instant Rails. Firstly I open up a ruby console  
window, and go to the directory of my app, named training. As soon as  
I get there I type script/generate and it says ‘script’ is not  
recognized as an internal or external command… I also tried script/  
generate say (that will be the name of the controller). That gives the  
same output. I’ve also tried:  
script/generate controller  
script/generate controller say  
./script/generate controller say  
/script/generate controller say  
etc.  
I checked and I have the folder script, with generate inside. I’m been  
trying to figure this out for days, so please, any help would be  
deeply appreciated. If I am unclear, please say so.

Thanks in advanced for your time and help.

---

<div class="post-metadata">

**Author:** ![cz231](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/839c29/32.png) [@cz231](https://www.ruby-forum.com/u/cz231)\
**Post date:** [March 25, 2008, 11:57pm UTC](https://www.ruby-forum.com/t/creating-a-controller/132943/2 "2008-03-25T23:57:51Z")

</div>

I’m not on windows, but I think you need to do:

ruby script/generate controller say

If you just:  
ruby script/generate controller

it will display a brief help of the command and options.

---

<div class="post-metadata">

**Author:** ![cz231](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/839c29/32.png) [@cz231](https://www.ruby-forum.com/u/cz231)\
**Post date:** [March 25, 2008, 11:59pm UTC](https://www.ruby-forum.com/t/creating-a-controller/132943/3 "2008-03-25T23:59:38Z")

</div>

Thanks for the quick reply!  
Man I feel like a complete idiot! After looking at only one other post  
here I realized I was forgetting to put ruby in front of script.

Thanks again, problem solved though.

---

<div class="post-metadata">

**Author:** ![cz231](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/839c29/32.png) [@cz231](https://www.ruby-forum.com/u/cz231)\
**Post date:** [March 26, 2008, 12:01am UTC](https://www.ruby-forum.com/t/creating-a-controller/132943/4 "2008-03-26T00:01:59Z")

</div>

On windows you’ve got to say:

ruby script\generate blah blah blah

So-just throw a "ruby " on the front there & you should be good.

BTW, what that’s doing is taking the ruby script called  
‘generate’ (note the lack of a file extension–very non-windows-y)  
which lives in the ‘script’ subdirectory of your app, and passing it  
to the ruby interpreter. On other platforms you just pass the script  
file to the OS for execution, and it looks on the “shebang” line (the  
one starting with #!) to see what binary executable to use.

Cheers,

-Roy

---

<div class="post-metadata">

**Author:** ![cz231](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/839c29/32.png) [@cz231](https://www.ruby-forum.com/u/cz231)\
**Post date:** [March 26, 2008, 12:00am UTC](https://www.ruby-forum.com/t/creating-a-controller/132943/5 "2008-03-26T00:00:13Z")

</div>

ruby script/generate controller say

You need ruby at the start of the command or windows will trow a wobly  
at you 🙂
