[Rails] RHTML in database?

Jeff Barczewski jeff.barczewski at gmail.com
Wed Jul 26 21:01:07 GMT 2006


It is possible to serve all your rhtml from a non-file based location but
not without a few changes to the Rails core classes.  For the MasterView
project we wanted the ability to retrieve rhtml through our own consolidated
IO layer so that it would allow retrieval from database, alternate paths, as
well as allowing the content to run through filters. With a little digging
in the Rails code I was able to hook the right classes to get this to work
(retrieval from non-file based locations), however I am wanting to submit a
patch to the Rails core team so that people could hook in easier, right now
there are File.method calls inside some of the key Rails core methods which
means there is not a clean way to hook rails.  I stubbed out the code for
doing database based retrieval but didn't get to finish that yet.

I believe that with regards to rhtml that it was the most difficult to get
layout rhtml from a non-file location, the other view rhtml and partials
were more easily hooked as I recall. So if you are only doing view or
partials your work should be a little easier.

When I can find some time to put together a more generic patch, then I will
submit that to the Rails core team so that all rhtml access can be easily
hooked into other mechanisms.

Also I haven't checked if edge rails makes this any easier yet, obviously
one should do that first to see if a change has already been made.

If you would like some pointers on how to go about doing this, I'd be glad
to point you to the code in my project that accomplished it.

Jeff Barczewski
MasterView Project founder - rails-optimized (x)html-friendly template
engine
http://masterview.org/



On 7/26/06, Bojan Mihelac <lists at mihelac.org> wrote:
>
> Hi,
> is it possible to store RHTML templates or partials in database?
>
> thanks,
> Bojan Mihelac
> --
> Bojan Mihelac
> Informatika Mihelac, Bojan Mihelac s.p.  |  www.informatikamihelac.com
> -> tools, scripts, tricks from our code lab: http://source.mihelac.org
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060726/9b6508eb/attachment.html


More information about the Rails mailing list