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?