Rendering radius inside preview extension

Hi, everyone. I’m new to Radiant, developing my first Radiant-powered
I’ve developed a preview extension, which injects via javascript a
link into the page editor, which when clicked hides the textbox and
shows a
div filled with the preview (obtained through Ajax.Updater). To
this, I have a controller method which takes the raw text from the
and returns rendered html. My problem is, while my method works fine for
built-in radius tags, it does not work for radius tags defined in
extensions. My code is below.
def filter_text(filter, text, slug)
filterClass = nil
eval(“filterClass = #{filter}Filter”)
filter =
filteredText = filter.filter(text)
page = Page.find(:first, :conditions => [“slug = ?”, slug])
context =
parser =, :tag_prefix => ‘r’)
return parser.parse(filteredText);
return filteredText

I admit that I don’t really have much of an idea of what I’m doing here.
I’ve been looking through the code of Radiant trying to figure out how
does it, but I’ve been unable to find the place where it actually does
rendering (I assume it’s somewhere in the Page model, but the only
code I’ve been able to find there I’ve replicated above). Any help would
greatly appreciated.


Feel free to rip the controller code from the page_preview extension
that I wrote for the facets branch. The code is here:

This module is included into the admin/page controller, giving it a
“preview” action. Essentially it wraps the creating and updating of
associated page-parts in a transaction, then raises an exception so the
transaction rolls back. However, the render has happened already inside
the transaction, so you get the page as it would look on the site.



I’ve looked at that code, but I’m having some trouble understanding a
lot of
it, in particular the call to handle_new_or_edit_post, which seems to do
something very different in the trunk than it does in the facets branch.
Additionally, I’d rather not save the page (which is what that extension
appears to do). Is there a simple way to modify my code so that it will
import non-radiant radius tags?

It doesn’t actually save the page. When exceptions are raised inside a
transaction, they rollback.