Elizabeth Buckwalter
Elizabeth Buckwalter

Reputation: 968

Rails not loading application.html.erb, instead loading view stubs

My application.html.erb is a classic file with the <%= yield %> statement. The expected would be if I went to domain.com/controller/action that it yields to the view in the appropriate directory. Instead, it's pulling up just the view (the correct view, but without the application wrapper). (There's no other layouts other than application)

This is my second rails application. The other one went smoothly, but this one is giving me one problem after another. I rtfm'd and googled and came up with nothing. I even rebooted webrick, though I didn't restart apache (proxypass to webrick), as I thought that overkill. Not to mention we host some low-volume websites.

The strangest thing is, when I call the root ie: domain.com it calls application.html.erb and yields to the home view.

I did use scaffolding, but it was my understanding that calling script/generate scaffold simply builds files and doesn't configure anything except routes. Which I already fixed.

Things I thought might help answer question. Let me know if you need more.

Devel logs where it's obvious that layouts application isn't loading:

domain.com

Processing HomeController#index (for 24.20.194.187 at 2009-09-03 15:24:15) [GET]
  Parameters: {"action"=>"index", "controller"=>"home"}
  ESC[4;35;1mCompany Columns (2.6ms)ESC[0m   ESC[0mSHOW FIELDS FROM `companies`ESC[0m
  ESC[4;36;1mCompany Load (0.4ms)ESC[0m   ESC[0;1mSELECT * FROM `companies` WHERE (`companies`.`subdomain` = 'slate') LIMIT 1ESC[0m
Rendering template within layouts/application
Rendering home/index
  ESC[4;35;1mUser Columns (2.6ms)ESC[0m   ESC[0mSHOW FIELDS FROM `users`ESC[0m
  ESC[4;36;1mUser Load (0.4ms)ESC[0m   ESC[0;1mSELECT * FROM `users` WHERE (`users`.`id` = '2') LIMIT 1ESC[0m

domain.com/users

Processing UsersController#index (for 24.20.194.187 at 2009-09-03 15:24:03) [GET]
  Parameters: {"action"=>"index", "controller"=>"users"}
  ESC[4;36;1mCompany Columns (2.6ms)ESC[0m   ESC[0;1mSHOW FIELDS FROM `companies`ESC[0m
  ESC[4;35;1mCompany Load (0.4ms)ESC[0m   ESC[0mSELECT * FROM `companies` WHERE (`companies`.`subdomain` = 'slate') LIMIT 1ESC[0m
  ESC[4;36;1mUser Columns (2.7ms)ESC[0m   ESC[0;1mSHOW FIELDS FROM `users`ESC[0m
  ESC[4;35;1mUser Load (0.4ms)ESC[0m   ESC[0mSELECT * FROM `users` ESC[0m
Rendering users/index
  ESC[4;36;1mSQL (0.2ms)ESC[0m   ESC[0;1mSET NAMES 'utf8'ESC[0m
  ESC[4;35;1mSQL (0.2ms)ESC[0m   ESC[0mSET SQL_AUTO_IS_NULL=0ESC[0m

application.html.erb [edited element contents]:

Oh right. less than greater than. suffice it to say, it has the html, head, and body tags, with a <%= yield %> statement.

Upvotes: 3

Views: 3494

Answers (1)

Andy Gaskell
Andy Gaskell

Reputation: 31761

First confirm that the only file in views/layouts is application.html.erb, then double check your UsersController and make sure that any line specifying the layout is removed.

Upvotes: 4

Related Questions