I'm trying to replicate the Snippet functionality in typical CMSs. I
have a table called "Pages" and "Snippets", where the latter is inserted
into the former.

I want the @page.body to replace anything between these tags {{ }} with
its appropriate snippet title (e.g., {{ Footer }}).

I'm thinking something along the lines of:

<%=h @page.body.gsub("ANYTHING_BETWEEN_{{_}}_TAGS",
Snippet.find_by_title("APPROPRIATE_SNIPPET_TITLE_HERE").body ) %>

Any ideas?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to