From: Jeremy McAnally Date: 2007-03-21T02:44:32+09:00 Subject: Re: Nees Rhtml Book That's not entirely true; if you're using eRb with Rails, it requires that templates end in rhtml or erb. Otherwise, you could coceivably use it without an extension. --Jeremy On 3/20/07, John Joyce wrote: > You could use eRuby with any .extension > In fact you could serve web pages with any or no dot extension. > The key is that the server knows what to do with it. > An example is Apache. You tell Apache what to do with files of > various extensions. You could tell it to parse all .html files with > Ruby, or all .php files with Perl. > Thus, many rails pages show URL/URI with no dot extension at all in > the web browser. It is important only if you use multiple language > interpreters or your web application framework requires it. > > On Mar 21, 2007, at 1:38 AM, Rick DeNatale wrote: > > > On 3/19/07, Corey Konrad <0011@hush.com> wrote: > > > >> yeah rhtml is just html the r part of it is just there to tell rails > >> that the name of the rhtml file is the name of an action. > > > > Not really, the rhtml tells rails (or more precisely ActionView) that > > the file needs to be processed by erb. It really doesn't tell it that > > it's the name of an action, although if rails doesn't find an action > > method in the controller, it will by default look for a file to render > > in app/views/controller_name. This file can be an rhtml file or > > something else (like a simple html file). > > > > Rhtml is html with embedded ruby. It does get processed on the server > > side by erb, or an equivalent program. What basically happens is that > > it get's turned into ruby code which writes out the html portions > > interspersed with the output from the embedded ruby code. > > > > There's not much to it in normal usage. The key concepts are that > > ruby code gets embedded within <% %> pairs, If the first <% is > > followed by an = sign, then the value of the ruby expression following > > is inserted into the output. > > > > The client browser never sees the rhtml, only the (x)html which > > results from running erb. > > > > > > -- > > Rick DeNatale > > > > My blog on Ruby > > http://talklikeaduck.denhaven2.com/ > > > > > -- http://www.jeremymcanally.com/ My free Ruby e-book: http://www.humblelittlerubybook.com/book/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/