I currently have two Rails apps for my site: one Radiant that serves
the static context and a regular Rails app that does forms and
authentication. Apache sits in front and figures out which app gets
It’s becoming a problem – as you can imagine – since both apps need
to look the same. What I’d really like to do is merge the dynamic
functionality into an extension and use Radiant to wrap the dynamic
content with the specified layout.
I’ve read the tutorial on creating extensions and have already created
a custom tag or two. But I can’t figure out how to use my layout when
rendering from my extension:
Define a new custom route
class UserStatusExtension < Radiant::Extension
define_routes do |map|
map.with_options(:controller => ‘foo’) do |foo|
foo.bar ‘foo/bar’, :action => ‘bar’
Have empty action that should point right to view
Hello from Bar!
Now when I hit my Radiant app with: http://localhost:3000/foo/bar
“Hello from Bar!” is rendered, but it is rendered using the Radiant
admin layout (in radiant/app/views/layouts/application.rhtml.
However, I want to be able to specify (either in my controller or my
view) to use the custom layout that is being pulled from the Radiant
database. For example, can I do this in my controller:
Does this make sense? Is anyone else mixing apps like this? Is
anyone doing forms in Radiant and how are you going about it?
Thanks a lot. I hope to add to the site’s documentation once I get my
thoughts together and get through this project.