# Rolling with Rails, ( Revisited version ) question?

**URL:** <https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357>\
**Category:** Rails\
**Created:** [March 2, 2007, 12:11am UTC](https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357 "2007-03-02T00:11:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@Davo](https://www.ruby-forum.com/u/Davo)\
**Post date:** [March 2, 2007, 12:11am UTC](https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357/1 "2007-03-02T00:11:04Z")

</div>

Hi everyone,

I recently noticed that the Rolling with Rails tutorial has had an  
update…

It all went well, but at the stage where you delete either of the  
files ‘category.rhtml’ or ‘recipe.rhtml’ & rename the remaining one to  
application.rhtml I get stuck.

The recipie link shows OK so is clearly using the application.html but  
when I click on the new footer link ‘Show all categories’ I get an  
error:  
No such file or directory - C:/Documents and Settings/dave/user/  
cookbook2/config/…/app/views/layouts/category.rhtml

( If I put the category.rhtml file back - I don’t get the error )

But the tutorial said that it will default to application.rhtml if  
category.rhtml does not exist ?

I’m sure I’ve followed every step, but it’s got me stumped…

TIA - Dave P.

---

<div class="post-metadata">

**Author:** ![Davo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@Davo](https://www.ruby-forum.com/u/Davo)\
**Post date:** [March 2, 2007, 1:25am UTC](https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357/2 "2007-03-02T01:25:14Z")

</div>

Hi Dave,

Hope you don’t mind a little probing. Never seen this one before.

Davo wrote:

> The recipie link shows OK so is clearly using the application.html

The file should be named with an extension of ‘.rhtml’, not ‘.html’. Is  
that just a typo above?

When you say ‘the recipie link shows OK’ do you mean the new footer  
shows up  
and clicking the 'Show all recipes" link works ok? But clicking the  
‘Show  
all categories’ throws an error?

Also, would you double-check that application.rhtml is the only file in  
the  
app\views\layouts directory? It should be.

> But the tutorial said that it will default to application.rhtml  
> if category.rhtml does not exist ?

It will if it can find a file named application.rhtml in the  
app\views\layouts directory.

Let us know on the questions above.

Best regards,  
Bill

---

<div class="post-metadata">

**Author:** ![Davo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@Davo](https://www.ruby-forum.com/u/Davo)\
**Post date:** [March 2, 2007, 2:29am UTC](https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357/3 "2007-03-02T02:29:17Z")

</div>

Hi Bill,

Thanks for responding…

Yes the html was just a typo and Yes application.rhtml does exists and  
Yes the recipe shows OK and the links in the footer are there and the  
recipe ones work but the category one ( show all categories ) throws  
the error:

Template is missing  
Missing layout C:/Documents and Settings/dave/user/cookbook2/config/…/  
app/views/layouts/category.rhtml

regards, Dave

---

<div class="post-metadata">

**Author:** ![Davo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@Davo](https://www.ruby-forum.com/u/Davo)\
**Post date:** [March 2, 2007, 5:16am UTC](https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357/4 "2007-03-02T05:16:31Z")

</div>

Hi Dave.

Davo wrote:

> I noticed you said application.rhtml should be the  
> only file in layouts folder.
> 
> I did have two other files there:  
> category.old &  
> application.rhtml.bak

This info is key. Thank you for documenting it. More below.

> So I moved them out of there & guess what - it now  
> works OK.
> 
> I would love to hear an explanation on this - I would  
> have assumed that because the application.rhtml was  
> the only rhtml file there, that should have been sufficient,  
> but clearly not !

I’ve been thinking about this for a couple of hours now and I honestly  
don’t  
know yet whether to call it a bug in Rails or something we just need to  
warn  
folks about. Here’s my thinking so far. I’d appreciate any input.

1. link\_to takes a url as its target.
2. a url is a path into a web domain that ultimately resolves to a file  
path  
on a server
3. a url is parsed right to left
4. a file path is parsed left to right

So the question, I think, is: what can we reliably use to trigger the  
switch in a parser from a url-based approach to a file-system-based  
approach?

The double dot notation you used on the file name is now perfectly valid  
file path notation for Windows file systems. It’s also perfectly valid  
url  
notation. The parser has to decide where the file path ends and the url  
starts.

My gut feel at this point is that this should be called a Rails ‘bug’.  
OTOH, it could just as easily be called an inescapable artifact of the  
transition we’re in the middle of from a ‘local’ file system based model  
to  
a web based model of data locations. I never thought about this before  
but  
I’m not sure there’s really any reliable way to tell the difference. I  
need  
some sleep, more thought, and some other’s input before I’d be ready to  
take  
a position. In the meantime, I think you’d definitely be doing the  
Rails  
community a service by updating the O’Reilly site with your findings.

Thanks for the thought-provoking find.

Best regards,  
Bill

P.S. I’m glad you got un-stuck too. Welcome aboard!

---

<div class="post-metadata">

**Author:** ![Davo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@Davo](https://www.ruby-forum.com/u/Davo)\
**Post date:** [March 2, 2007, 2:34am UTC](https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357/5 "2007-03-02T02:34:17Z")

</div>

Hi Bill ( and anyone interested ! )

I noticed you said application.rhtml should be the only file in  
layouts folder.

I did have two other files there:  
category.old &  
application.rhtml.bak

So I moved them out of there & guess what - it now works OK.

I would love to hear an explanation on this - I would have assumed  
that because the application.rhtml was the only rhtml file there, that  
should have been sufficient, but clearly not !

regards, Dave

---

<div class="post-metadata">

**Author:** ![Davo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@Davo](https://www.ruby-forum.com/u/Davo)\
**Post date:** [March 2, 2007, 9:04am UTC](https://www.ruby-forum.com/t/rolling-with-rails-revisited-version-question/87357/6 "2007-03-02T09:04:46Z")

</div>

Hi Bill,

Thank you for your thoughts…

& yes I have already asked the same questions on the tutorial, but  
will post a follow up with the findings…

regards, Dave
