# Question about ruby script/generate controller

**URL:** <https://www.ruby-forum.com/t/question-about-ruby-script-generate-controller/173718>\
**Category:** Rails\
**Created:** [August 13, 2009, 7:04pm UTC](https://www.ruby-forum.com/t/question-about-ruby-script-generate-controller/173718 "2009-08-13T19:04:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shusseina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d78d45/32.png) [@shusseina](https://www.ruby-forum.com/u/shusseina)\
**Post date:** [August 13, 2009, 7:04pm UTC](https://www.ruby-forum.com/t/question-about-ruby-script-generate-controller/173718/1 "2009-08-13T19:04:01Z")

</div>

Imagine I have a model called blog and I then run the following  
command to create a controller for it.

ruby script/generate controller Blogs index

At some later point I want to create a ‘new’ page to submit blogs. Is  
there a recommended way for doing this? Should I simply create the  
file app/views/blogs/new.html.erb or should I instead run the command  
below? Is there any difference?

ruby script/generate controller Blogs new

Thanks

---

<div class="post-metadata">

**Author:** ![shusseina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d78d45/32.png) [@shusseina](https://www.ruby-forum.com/u/shusseina)\
**Post date:** [August 13, 2009, 7:26pm UTC](https://www.ruby-forum.com/t/question-about-ruby-script-generate-controller/173718/2 "2009-08-13T19:26:16Z")

</div>

On Thu, Aug 13, 2009 at 10:02 AM, shusseina [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 

Just use your text editor of choice and create the template  
file, new.html.erb.  
Then you need to remember to add the action, ‘new’, to the  
blogs\_controller.

> ruby script/generate controller Blogs new

Now, if you run the command again on the same controller, you should see  
something like this:

```
 exists app/controllers/
  exists app/helpers/
  exists app/views/posts
  exists test/functional/
  exists test/unit/helpers/

```

overwrite app/controllers/blogs\_controller.rb? (enter “h” for help)  
[Ynaqdh]

Then you can select ‘n’ if you have modified blogs\_controller.rb or ‘Y’  
if  
have not modified this file. Then you’ll need to add the controller  
action,  
‘new’,  
to blogs\_controller.rb but you wouldn’t have to create the new.html.erb  
file.

Good luck,

-Conrad

> Thanks
