I need to be able to merge a lot of content for web pages, along with
links to other pages taken from a list of categories. The text that goes
with each category can be different depending on the context that it’s
I could do this by having a whole stack of *.html.erb files which hold
the static content and access the Rails helpers to pull in stuff from
the database and build the links & etc. But that’s a rubbish way to do
things because I’d end up with too many *.erb files to manage. I want to
keep these little snippets of erb or haml ready texts in the DB where
they belong, and pull them out and process them into html when required.
But… how do I get access to the rails helpers when I’m inside these
Basically I need to call render, without the layout, and then grab the
result and put that into the final page. Sort of like a partial, expect
that it’s not something that can be generalised. But I don’t want render
to then disappear off and hand the result back to the caller I want
render to give me the result and then I’ll merge it with other bits and
then hand the completed page to the caller.