How to serve rhtml files under /public, not /app/views?

Dear all,

I'm running Instantrails on Windows, and I'm wondering if I can put
some ruby code to html files under the /public folder. (rather than
those application code under the /app folder)

Do I need to tune something in mongrel so that it can parse those
rhtml files with a ruby intepreter?



'coz the /app structure in the rails framework is very application
centric, and it could be useful if i can have some (not too much) code
in the (r)html files.

for instance, i'm creating a corporate brochure type of website and
like 80% of the stuffs're static pages by the designer. i tend to put
the designer's work in /public. even then, on those static pages, what
if i need something as simple as <>.. it would be
useful if i can just parse a minimal amount of ruby code there.


in some cases yes, client side js would suffice..
but my example might not be a good one.. there're still times
when i would rather have server side scripts available on rhtml files.

is there a way? or really every piece of code has to be in /app?


thanks Jean, yes i understand your point and i agree it's better to do
it the proper way.

one other reason this question came to my mind is that i think i've
seen on some website (though i don't recall the exact site names now)
with url's ending with a ".rhtml", and i thought maybe this can be
like jsp / asp / php it could be used casually, on a page by page
basis as well.

with your solution "render :file => path" the controller is still the
central point of the request. i'm thinking, technically, can i have
something like http://domain/somefolders/somepage.rhtml ? i mean, not
thru the rails routing but rather somefolders/sompage.rhtml are simply
within /public. (though not a good practice, but this should be
technically feasbile shouldn't it?)


Hi all, thanks.

i agree with all your comments; and yes i think something like
mod_ruby probably answers my original question.

and yes that probably isn't a rails issue to begin with, it's really
all about interpreting ruby code by the web server. not that i really
need it to work in that way, but i was just so curious to know if it's
technically feasible.

Thanks anyway, cheers!