Welcome Guest | Login

My app doesn't see my application.rhtml?

I am trying to use a global layout (i.e., application.rhtml) but it is not being picked up by my app. If I'm reading my log correctly, it seems that it is looking for a template with the same name as my controller in my layouts directory. But there is no template file with that name in the layouts directory and so it dies. But the real question is why doesn't it look for application.rhtml first?

Here is a snippet from my log (my controller's name is 'search'):

Processing SearchController#index (for 24.250.117.70 at 2007-08-18 21:10:41) [GET]
 Session ID: fe37b03aa45d3f947370173f6000fce3
 Parameters: {"action"=>"index", "controller"=>"search"}
Rendering  within layouts/search
Rendering search/index


ActionView::TemplateError (No such file or directory - ../config/../app/views/layouts/search.rhtml) in app/views/layouts/search.rhtml:


Does anyone have ideas about why this might not be working? Are folks using this feature successfully?

Thanks,
Tina

2007-08-18 09:47 PM

Most likely at the top of your search_controller.rb file you have a command:
layout 'search'
That's put in automatically by some scaffolding.  This forces the controller to want to use the search scaffold.

2007-08-19 08:12 AM

Thanks, Luminous... I checked, but there is no layout command at all in my search_controller.rb.

Any other ideas about what could cause this?

2007-08-19 01:10 PM

Hmmm - something must be triggering and forcing a "layout => true" or something like this that makes Rails think you have a layout there.  If you put in a blank layout file there does it indeed just render a blank white layout?  

2007-08-19 07:14 PM

Yes, if I put a blank layout file, it sees it and renders a blank page.

Thanks, guys, for your help. I know it's difficult to debug someone's stuff when you can't see it. I realize that I am probably just doing something really dumb (and/or careless).

2007-08-19 08:22 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!