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, 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? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Loganathan Ganesan
2010-Mar-22 05:22 UTC
Re: "Missing Template" when manually creating views
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, 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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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." On Mar 22, 5:56 am, tuti plain <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 accesshttp://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? > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Mar 21, 2010 at 8:56 PM, tuti plain <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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, 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? >Hi, you''ll need to rename the ''receta'' folder to ''recetas''. Good luck, -Conrad> -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> I have created a single file named index.html.erb inside > app/views/receta.As the message says, it should be app/views/recetas On Mar 22, 5:56 am, tuti plain <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 accesshttp://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? > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 22 March 2010 11:54, tuti plain <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.