Using Rails app within radiant


I have radiant running my website and would like to use some models
and functions from another rails app running in the same server. Any
ideas on how to do this if its possible?

Thanks in advance,



If your app is ActiveResource-compatible, that might be an easy way to
integrate them.


Well, my rails app it’s a bit old, so it’s not
ActiveResource-compatible. It would be great though, to rewrite it and
make it RESTful in the future, but currently I don’t have the time. Is
there another way to achieve what I’m looking for?



You could import some of your models into a Radiant extension and then
use them there. They may have to connect to your other database
manually, i.e. inside their declaration.


Hi Sean,

I’ve explored further this approach and it looks exactly what I’m
looking for, but I’m having problems loading the AR models into

I created the extension and the custom tags, (pretty easy and slick
indeed :), and put the require environment.rb of my rails app at the
top of the
file but I got this errors:

warning: already initialized constant OPTIONS
undefined method `options’ for []:Array (NoMethodError)

and the radiant’s mongrel server doesn’t boot anymore.

Do I need to require the environment.rb file somewhere else or is
there other method to load my app’s models into the radiant.

Thanks in advance!


I’ve copied my rails app environment.rb customizations to the radiant
project’s environment.rb and it’s now it’s loading ok, but still my
models are not yet accesible from radiant. I’m using
ActiveRecord::Base.establish_conection in the extension’s activate
method to connect to the rails db, but I don’t know how to load my
rails model definitions. Could you please give me some details on how
to do it? Sorry if it’s something obvius but I’m really lost here.

Thanks a lot for your help,



You shouldn’t require the environment.rb of your Rails app directly.
Copy any customizations you have made either into your Radiant
project’s environment.rb or into the activate method of your
extension. Hopefully that should fix the issue.


As long as they are in app/models or lib/ of your extension, they
should be accessible; that is, they will be in the load path. How you
integrate them into the Radiant application is another story… you
may need to create some controllers and views, or maybe some Radius
tags. Both of those are briefly covered in the extension tutorial on
the wiki.