Can you put layout rhtml into a database blob

Is there a way to move the layout .rhtml into a database blob?

I would like to get the information from the database and pass that to
the ActiveRecord layout and then have it pull the rest as normal.

e.g.

class WeblogController < ActionController::Base
layout :get_template

def get_template
@attachment = current_project.layout
send_data(@attachment.get_data(current_project),
:filename => @attachment.name,
:type => @attachment.content_type,
:disposition => ‘attachment’)
end

so that the layout can be passed from the database (or maybe not even
as an attachment just as a long text field).

any ideas?

ian wrote:

def get_template
any ideas?
The layout needs to be a file on disk cf. the source of
ActionController::Base.

What you can do is either: Write the layout to disk before calling
render or create your own layout system and use render :text.


Cheers,

  • Jacob A.

Hi,

Layouts might be a bit much, I was looking for something like a
blogger template that you can insert partial files in given places.

This way you could add a banner, table of contents, comments, footer,
etc in the template and have this render like a layout and pull in
partials and page variables as needed.