small medium large xlarge

23 Jul 2009, 18:31
Tomasz Barczynski (3 posts)

I have added

layout "store"

to the top of ApplicationController, then removed (renamed in fact): * products.html.erb * users.html.erb * orders.html.erb

as instructed on pages 174-175 (P2.0). Now, instead of getting default store layout for these three views, I am getting the below error (with respective layout name).

bq. Template is missing Missing layout layouts/products.erb in view path /home/tomek/work/depot/app/views:

When I restore layouts, all works again. When I add

layout "store"

to each individual controller, it also works. What do I miss or do wrong?

23 Jul 2009, 19:05
Tomasz Barczynski (3 posts)

I just realized that my issue is identical to the one raised by Sean Katz at Jan 19, 2009 I have also found the solution. It is simple but strange and I do not understand it. As I mentioned on my initial post, I did not remove scaffold generated layouts, but just renamed them, by simply adding “.cp” at the end of a file name.

cp app/views/layouts/products.html.erb   app/views/layouts/products.html.erb.cp
cp app/views/layouts/users.html.erb      app/views/layouts/users.html.erb.cp
cp app/views/layouts/orders.html.erb     app/views/layouts/orders.html.erb.cp

When I actually removed files, it worked as expected. Can anyone explain it? Are my new names to close to originals? Or maybe the extension “.cp” means something to RoR? Should it be considered as RoR bug?

You must be logged in to comment