# Where is the controller's default view template?

**URL:** <https://www.ruby-forum.com/t/where-is-the-controllers-default-view-template/149371>\
**Category:** Rails\
**Created:** [September 24, 2008, 9:29am UTC](https://www.ruby-forum.com/t/where-is-the-controllers-default-view-template/149371 "2008-09-24T09:29:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sudhir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sudhir](https://www.ruby-forum.com/u/Sudhir)\
**Post date:** [September 24, 2008, 9:29am UTC](https://www.ruby-forum.com/t/where-is-the-controllers-default-view-template/149371/1 "2008-09-24T09:29:42Z")

</div>

Hi,

When I moved from Rail 1.2 to 2.0.2, “script/generate controller xxx”  
stopped creating a default layout template in app/view/layouts/. But  
the code still works and likely gets a default template for the  
controller from somewhere.

Can someone say where this template is stored?

When I want to change something in the controller template, I have to  
copy a template from one of my older projects where this template was  
generated with pre-2.0 Rails. Is there a better way?

Thanks for any info.

=sudhir.

---

<div class="post-metadata">

**Author:** ![Sudhir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sudhir](https://www.ruby-forum.com/u/Sudhir)\
**Post date:** [September 24, 2008, 11:54am UTC](https://www.ruby-forum.com/t/where-is-the-controllers-default-view-template/149371/2 "2008-09-24T11:54:11Z")

</div>

Am Dienstag, den 23.09.2008, 15:34 -0700 schrieb Sudhir:

> When I moved from Rail 1.2 to 2.0.2, “script/generate controller xxx”  
> stopped creating a default layout template in app/view/layouts/. But  
> the code still works and likely gets a default template for the  
> controller from somewhere.
> 
> Can someone say where this template is stored?

the default template is app/view/layouts/application.html.erb

Greetings  
Johannes

---

<div class="post-metadata">

**Author:** ![Sudhir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sudhir](https://www.ruby-forum.com/u/Sudhir)\
**Post date:** [September 24, 2008, 8:22pm UTC](https://www.ruby-forum.com/t/where-is-the-controllers-default-view-template/149371/3 "2008-09-24T20:22:55Z")

</div>

On Sep 24, 2:53 am, “Johannes J. Schmidt” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Am Dienstag, den 23.09.2008, 15:34 -0700 schrieb Sudhir:

> the default template is app/view/layouts/application.html.erb

Really? I could not find this file in my workspaces. I tried creating  
a fresh project and a fresh controller with Rails 2.1.1. It does not  
create application.html.erb anywhere in my workspace. Perhaps the file  
is elsewhere?

I did find layout.html.erb in my Rails install directory which appears  
close to what I would expect from a default view template. I found it  
here:  
lib/ruby/gems/1.8/gems/rails-2.1.1/lib/rails\_generator/generators/  
components/scaffold/templates/layout.html.erb

Can anyone confirm that that’s where we need to go to get a default  
controller view template? Or maybe there is a “script/generate  
default\_layout” kind of command to create this in a workspace?

Thanks.

=sudhir.
