The short version: Is it possible to use ERB within Radiant snippets or
pages? (By filters maybe?)
The long version: I’ve a whole bunch of Rails applications within a same
domain including forum, wiki and so-on. They use a common template,
implemented by putting together a bunch of common partials, symlinking
to their physical location, then including those partials within the
default layout for each application. Repetition is minimised with in
general only application-specific variations in layouts. Ultimately
they’ll also share a secondary, common database with a superset of
authorisation/account details for single sign-on purposes.
Radiant is used for various reasons, for sections of the site that
aren’t publically editable. I’ve expressed the template partials through
snippets in Radiant with a default layout. It works well. I’ve extended
the snippet “new.rhtml” to include a “more/less”-style panel that takes
a filename; the database and table have an “auto_export” field validated
in the model; finally, a custom save method in the snippet controller
exports the snippet to the given filename if provided whenever that
snippet is updated.
This lets me export snippets as partials to the shared directory thus
providing control over the look and feel across multiple Rails
applications all from within Radiant. Only one problem; no ERB. The
snippets use it. In certain cases I’ve been able to hack an equivalent
using cunning but hideous arrangements of comments; application-specific
partials or snippets are included by commented-out ERB or Radiant tags,
then depending on whether Radiant or another app is running, one of
those two tags gets expanded so the snippet or partial gets included.
The included item closes off the open comment, does its thing, then
re-opens the comment again. I said it was hideous… Commented out bits
of ERB or Radiant tag end up in the served documents too, which is nasty
and it’s an extraordinarily limited approach compared to simply using
Any recommendations - is this a job for a filter?