Thanks, I understand that piece. I guess what I was after is... if I build two models, document and document_items with a belongs_to/ has_many relationship and set children, I get the master/detail type relationship of the document and all its content (document_items).
If I then build a third model, template_items, what I was thinking was having an aside that lists all the template items that the user can click to select one, which would copy the content from the template_item model and insert a new record with that content into the document_items for that document. Would the correct approach be to build a custom action, against the template_item controller... say "copy_contents", that inserts that records values into the document_items table for the current document. The aside would then display a list of template_items, and I would somehow overide the links to each item in the aside to call "copy_contents" instead of template_item.show? I assume the copy_contents would call the document_item.create method with the selected template_item values. On Feb 28, 3:21 pm, "Todd A. Jacobs" <[email protected]> wrote: > > Want a solution to create multiple "documents" where the content for > > each document is made up of a number of templated "content blocks". > > I'm not really sure this is a Hobo issue, although I imagine defining > custom tags with DRYML could make the job easier. I saw something like > this a few years ago, and it was done using plain HTML form selects to > choose the desired content blocks--unwieldy if you are doing a really > large proposal, but similar in principle to what you're talking about. > > Just off the top of my head--completely untested, and worth what > you're currently paying me for skull sweat--you might consider a table > of content parts, and a join table to hold the per-proposal > selections. In other words: > > class Document < ActiveRecord::Base > belongs_to :proposal > has_many :blocks > end > > Once you know what you're rendering, you can focus on crafting the > right view to display it all properly. > > Hope that helps. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
