# "Missing Template" when manually creating views

**URL:** <https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519>\
**Category:** Rails\
**Created:** [March 22, 2010, 4:56am UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519 "2010-03-22T04:56:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [March 22, 2010, 4:56am UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519/1 "2010-03-22T04:56:37Z")

</div>

Hi everyone,

I am trying to set up a controller and a view manually, without the  
aid of scaffolding (though I am using a scaffolded model as reference).

I have set up my controller like this:

class RecetasController \< ApplicationController  
def index  
respond\_to do |format|  
format.html #index.html.erb  
end  
end  
end

I have created a single file named index.html.erb inside  
app/views/receta. So far in only has a few HTML lines. When I access  
[http://localhost:3000/recetas](http://localhost:3000/recetas), I get this message on my browser:

“Missing template recetas/index.erb in view path app/views”

What gives? Scaffolded models generate .html.erb files and they work  
right! So I go ahead and change my view to be named index.erb. I still  
get the same error message! What am I missing?

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [March 22, 2010, 6:22am UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519/2 "2010-03-22T06:22:19Z")

</div>

tuti plain wrote:

> Hi everyone,
> 
> I am trying to set up a controller and a view manually, without the  
> aid of scaffolding (though I am using a scaffolded model as reference).
> 
> I have set up my controller like this:
> 
> class RecetasController \< ApplicationController  
> def index  
> respond\_to do |format|  
> format.html #index.html.erb  
> end  
> end  
> end
> 
> I have created a single file named index.html.erb inside  
> app/views/receta. So far in only has a few HTML lines. When I access  
> [http://localhost:3000/recetas](http://localhost:3000/recetas), I get this message on my browser:
> 
> “Missing template recetas/index.erb in view path app/views”
> 
> What gives? Scaffolded models generate .html.erb files and they work  
> right! So I go ahead and change my view to be named index.erb. I still  
> get the same error message! What am I missing?

Could you please give the log printed in the webrick ?

Actually I faced this error during the time of placing wrong code inside  
environment.rb file.

Thanks

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [March 22, 2010, 8:29am UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519/3 "2010-03-22T08:29:52Z")

</div>

Hello,

I believe folder which holds views for recetas controller must be  
named in plural: recetas  
…from your post i can see that its in singular: “I have created a  
single file named index.html.erb inside  
app/views/receta.”

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [March 22, 2010, 8:45am UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519/4 "2010-03-22T08:45:40Z")

</div>

On Sun, Mar 21, 2010 at 8:56 PM, tuti plain [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> format.html #index.html.erb
> 
> ```
> 
> What gives? Scaffolded models generate .html.erb files and they work  
> right! So I go ahead and change my view to be named index.erb. I still  
> get the same error message! What am I missing?

Hi, you’ll need to rename the ‘receta’ folder to ‘recetas’.

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [March 22, 2010, 12:54pm UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519/5 "2010-03-22T12:54:01Z")

</div>

Hi,

Thanks, you were right, renaming the folder solved the problem. I  
think I’ll never fully understand the plurals and singulars in Rails.  
What I don’t get is why the scaffolded model has its views named like  
.html.erb but my manually created one has to be .erb only. I have no  
problem in doing it like that, but I’d like to understand why it is.

Thanks again.

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [March 22, 2010, 9:15am UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519/6 "2010-03-22T09:15:30Z")

</div>

> I have created a single file named index.html.erb inside  
> app/views/receta.  
> As the message says, it should be app/views/recetas

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [March 22, 2010, 2:40pm UTC](https://www.ruby-forum.com/t/missing-template-when-manually-creating-views/185519/7 "2010-03-22T14:40:24Z")

</div>

On 22 March 2010 11:54, tuti plain [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> Thanks, you were right, renaming the folder solved the problem. I  
> think I’ll never fully understand the plurals and singulars in Rails.  
> What I don’t get is why the scaffolded model has its views named like  
> .html.erb but my manually created one has to be .erb only. I have no  
> problem in doing it like that, but I’d like to understand why it is.

They do not have to be named .erb only. Rails looks for a range of  
names, one of which is .erb, the error message can be confusing.  
.html.erb is the recommended way for html generated by erb.

Colin
