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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ian wrote:> 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?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 Atzen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Jul 12, 3:12 pm, Jacob Atzen <j...-4U2y0bnePT5NzRJJ8cAMrg@public.gmane.org> wrote:> ian wrote: > > 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? > > 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 Atzen--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---