# Radiant integration with another Rails app?

**URL:** <https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304>\
**Category:** Radiant CMS\
**Created:** [May 28, 2007, 6:04pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304 "2007-05-28T18:04:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 28, 2007, 6:04pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/1 "2007-05-28T18:04:41Z")

</div>

Does anyone have a successful example out there of putting Radiant in  
the vendor directory of an existing full-scale Rails app and having  
it play nicely?

I’ve tried unsuccessfully in the past, however with the final polish  
on 0.6 (and now 0.61) I’m ready to give it another shot.

I have an app I would like to do this with that I’ll be working on in  
a week or two.

For my use here are the two main issues that I know of are:

1. Routes… I can load my app’s routes first I essentially override  
everything but the final Radiant default “page not found” route.

2. Rendering of snippets or page parts with Radius tags in them  
straight in to my Rails app view… In particular, I imagine making a  
helper in my app for calling the Radiant content. Is there a way to  
render the snippet or part directly without creating a new  
PageContext every time it goes to render (I’d be doing this all  
through a Rails helper method I imagine…)

3. Less important to me, but interesting… the reuse of Layouts. Can  
I pull a layout as a Rails layout, ERB render and then do a final  
Radius render? Anyone tried this?

Anybody doing any of this yet?

Thanks,

Loren

> **[Resume - Loren Johnson](https://docs.google.com/document/d/1WfJomBItrSA281MMFbYpavEKLMkQAfG9pz0or0X5lBU/edit?usp=sharing)**
>
> LOREN JOHNSON 575-779-9996 | lorenjohnson@gmail.com | github.com/lorenjohnson | linkedin.com/in/johnsonloren EXPERIENCE Senior Software Engineer	April 2020 - Current Hylo.com – Terrans Collective Working full stack in Node, GraphQL, React, and...

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 28, 2007, 6:14pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/2 "2007-05-28T18:14:42Z")

</div>

Hi Loren,

Nice to talk to you again! 😉

I’m working on the same thing right now. I currently have a Radiant  
extension that allows Radiant to live in /vendor while having a Rails  
app at it’s current location with only a slight modification required  
for config/routes.rb to work properly.

It also has the ability to insert a snippet using a helper as you  
suggested, although I don’t know how robust it is depending on what  
radius tags are in that snippet. And yes, as you mentioned, it  
creates a Page object to do this.

I’m also very interested in allowing Rails pages to leverage Radiant  
layouts, and that is the next thing I plan to work on. Let me know  
if you’re interested in seeing the extension I have so far. I plan  
on creating a Rubyforge project for it, but I haven’t gotten around  
to that yet. Perhaps we can work together to get this done. I also  
think that Sean was working on the layout problem, too. So maybe he  
already has made some progress in that area.

Thanks,  
Matt

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 28, 2007, 6:26pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/3 "2007-05-28T18:26:44Z")

</div>

Hey Matt,

Funny – I knew I talked to someone about this at RailsConf and I  
just couldn’t remember who… Now I remember our discussion well.

Yes, I’d very much like to help out in whatever way I can. I really  
want to see this happen and end-up with something that makes the  
integration dead simple to accomplish.

Love to see what you’ve got so far and talk more. It’d be especially  
nice to see how you’re using it in your existing app. I still have  
your card here, I’ll give you a shout later today or tomorrow to talk  
approaches and see in what way I might be able to pitch-in, etc.

Maybe it’d be nice to set a date and time for you, Sean and myself  
(and anyone else interested) to meet-up in #radiantcms IRC on this  
topic…

Glad there is something already happening on this front!

Loren

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 28, 2007, 7:40pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/4 "2007-05-28T19:40:53Z")

</div>

Hello everybody  
I have a site with a node page called news, inside that I have some  
subpages and some other nodes with subpages in them.  
I am using children:each to show all subpages of news, but I need to see  
subpages of other nodes too called for example sction1 and section2. So  
I put another cycle children:each inside the first one.  
It is ok, but I see the nodes pages too.  
I am trying to use unless\_url matches=“section\d$” to match all pages  
that ends with that url to avoid displaying nodes pages, but it doesn’t  
work. Is there some special way to use regexp inside radiant?  
Or maybe exist tag like unless\_parent but matching if a page  
has\_children?  
Thanks to everybody

–  
Francesco L.  
Ymir s.r.l.  
Viale Verona 190/11  
38100 Trento

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 28, 2007, 6:35pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/5 "2007-05-28T18:35:44Z")

</div>

I’m working right now to get a project created on RubyForge and  
trying to come up with a reasonable name for the extension. How does  
‘RadiantFromRails’ sound?

I’m up for getting together with you and Sean on IRC. I’d really  
like to hear Sean’s thoughts about how he might approach the issue of  
layouts as I haven’t really spent any time thinking about the  
implementation yet.

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 7:15am UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/6 "2007-05-30T07:15:24Z")

</div>

Matt,

RadiantFromRails sounds good to me.

Let me know when you get it set up, I’m anxious to give it a spin.  
Once I am sitting down to do that I’ll feed my experience back to you  
on how it goes.

Do you have a client use case for the integration? I think you said  
you did, but it’d be good to know your requirements as it seems that  
a completely general purpose integration method could be a stretch…

Feel free to AIM, call or email me if you’d like to bat any part of  
the implementation details around with someone.

Loren

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 7:44am UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/7 "2007-05-30T07:44:26Z")

</div>

Francesco,

It will help if you can post the code snippet with the nested  
\<r:children:each … tags in it to look at. If I am understanding  
what you’re describing correctly, yes I’d expect it to work as well.

If you’re still stuck post that section of code and maybe I can help  
more.

Loren

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 5:17pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/8 "2007-05-30T17:17:25Z")

</div>

Matt Parrish wrote:

> I’m working right now to get a project created on RubyForge and  
> trying to come up with a reasonable name for the extension. How does  
> ‘RadiantFromRails’ sound?
> 
> I’m up for getting together with you and Sean on IRC. I’d really  
> like to hear Sean’s thoughts about how he might approach the issue of  
> layouts as I haven’t really spent any time thinking about the  
> implementation yet.

If you get a plugin going, I’d be happy for it to live in the Radiant  
SVN repository.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 6:55pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/9 "2007-05-30T18:55:59Z")

</div>

John,

Are you suggesting that I develop from the Radiant SVN repository?  
Or are you saying that you’d be happy to host a copy of stable releases?

Also, the name I settled on was Radiant on Rails and it is a Radiant  
Extension.

Thanks,  
Matt

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 7:38pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/10 "2007-05-30T19:38:05Z")

</div>

Did you consider wrapping it up as a plugin? Off the top of my head  
that seems like it could be the cleanest way to go, but I say that  
without seeing how you have it setup now.

What is a basic sketch of the install process as it is?

Some way to embed in a straight Rails app is in my view a key piece  
of the puzzle that is Radiant’s future. I have frequent applications  
now that would use Radiant in this embedded way if an easy and  
unobtrusive way to do so was already established.

So as for going in the Radiant SVN I think it belongs there and I’m  
willing to pitch-in on the development effort if you want/need that.  
There are “in development” pieces in there already, so I think it’s a  
fine place for it. – But that just “like my opinion, dude”.

🙂

Loren

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 9:59pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/11 "2007-05-30T21:59:18Z")

</div>

On May 30, 2007, at 2:01 PM, Mario T. Lanza wrote:

> > I’m also very interested in allowing Rails pages to leverage Radiant  
> > layouts, and that is the next thing I plan to work on.
> 
> I find this is a very natural means of doing just what I have been  
> attempting to do all along. The only piece that I am missing is the  
> ability to take advantage of Radiant from the Rails side, which  
> apparently is a much sought-after piece that is now in the works.

I also wonder if the ability to take advantage of Rails partials in  
Pages/Snippets/Parts would be useful to Extension designers. It would  
primarily support creating models and tags which produce a kind of  
‘widgety’ thing - not necessarily for public/generic consumption, but  
for allowing Radiant Extension builders (developers working for CMS  
users) to encapsulate something, leveraging the power of Ruby/Rails  
while still protecting the CMS user from having the full power of Erb.

But are we going away from the ‘original intent’? There’s fascinating  
conversation about the meaning of a piece of literature: is it found  
in the text, in the author, or in the reader?

```
adam
```

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 8:01pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/12 "2007-05-30T20:01:08Z")

</div>

> I’m also very interested in allowing Rails pages to leverage Radiant  
> layouts, and that is the next thing I plan to work on.

I’m very happy to see this project forming. After tossing around many  
ideas for integrating custom Rails views within a Radiant site, I’ve  
formulated a pattern.

I simply create an extension and build the functionality exactly like  
I’m building a Rails app. I modify the routes in the extension  
initializer being careful to differentiate between back-end  
functionality (for the admin interface) and front-end functionality (for  
the sites users). Admin functionality is put in “admin” subfolders just  
as is already done with the Radiant admin stuff. For example, here are  
the routes I currently use for an in-progress extension that has both  
front-end and back-end interfaces.

define\_routes do |map|

#back-end interfaces  
map.admin\_event ‘admin/event/:action/:id’, :controller =\>  
‘admin/event’  
map.admin\_offering ‘admin/offering/:action/:id’, :controller =\>  
‘admin/offering’

#front-end interfaces  
map.offering ‘offering/:action/:id’, :controller =\> ‘offering’  
map.event ‘event/:action/:id’, :controller =\> ‘event’  
map.registration ‘registration/:action/:id’, :controller =\>  
‘registration’  
map.invitation ‘invitation/:action/:id’, :controller =\> ‘invitation’  
map.evite ‘evite/:action/:id’, :controller =\> ‘invitation’

end

There models are common, but there is a distinction between the  
front-end and back-end controllers and views.

I find this is a very natural means of doing just what I have been  
attempting to do all along. The only piece that I am missing is the  
ability to take advantage of Radiant from the Rails side, which  
apparently is a much sought-after piece that is now in the works.

At this point I am creating Rails layouts that are identical to their  
Radiant counterparts. It’s not DRY, but it is workable for the time  
being.

I’m eagerly anticipating seeing this extension so I can DRY things up.

Mario

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/13 "2007-05-30T22:50:34Z")

</div>

Loren J. wrote:

> Did you consider wrapping it up as a plugin? Off the top of my head  
> that seems like it could be the cleanest way to go, but I say that  
> without seeing how you have it setup now.

I think I agree with Loren that Radiant as a plugin is a much nicer way  
to go (vs. dropping it in your vendor directory). This way you could  
install the pluginized version of Radiant with a simple:

script/plugin install radiant

I’m willing to consider changes to Radiant make this integration easier.

> Are you suggesting that I develop from the Radiant SVN repository?  
> Or are you saying that you’d be happy to host a copy of stable  
> releases?

Perhaps you could work with Loren on this for the time being. He just  
recently joined core and it sounds like you have the same goals. When  
you have something ready you guys could drop it in:

[http://dev.radiantcms.org/svn/radiant/trunk/plugins/radiant/](http://dev.radiantcms.org/svn/radiant/trunk/plugins/radiant/)

I’d suggest that the plugin would have the following directory  
structure:

plugins/  
radiant/  
init.rb  
lib/  
vendor/  
radiant/ \<\<\< an svn:external to trunk/radiant

All of this talk makes me think that we need to move all of the Radiant  
models into the the top level Radiant module to avoid namespace  
collisions.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 10:58pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/14 "2007-05-30T22:58:35Z")

</div>

I like the idea of being able to install Radiant as a plugin as that  
will make it easier to integrate with an existing Rails application.  
However, when starting from scratch, the current method seems just as  
easy.

As for the RadiantOnRails extension, I’ll release that on RubyForge  
for use with 0.6.1 and work with Loren on getting it to a Plugin-ized  
version within Radiant SVN repository.

Loren, congrats on the promotion to Radiant Core team member! 🙂

Matt Parrish  
[http://www.pearware.org](http://www.pearware.org)

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 30, 2007, 10:07pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/15 "2007-05-30T22:07:19Z")

</div>

It looks like we’re both looking for the same goals out of this  
project. The number one feature for us is to reuse the Radiant  
layouts to keep that DRY. And that’s where this project will be  
going next.

As for the rails portion of the site, the other thing this extension  
allows for, is to be able to use the traditional RAILS\_ROOT/app/  
[controllers|helpers|models|views] folders instead of burying  
everything into /vendor/extensions. I think this also helps to  
create a cleaner split between Rails and Radiant code and also makes  
it easier to integrate Radiant into an existing Rails app.

Matt Parrish  
[http://www.pearware.org](http://www.pearware.org)

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 31, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/16 "2007-05-31T19:15:48Z")

</div>

The RadiantOnRails extension is now live on RubyForge at http://  
[www.rubyforge.org/projects/radiantonrails](http://www.rubyforge.org/projects/radiantonrails). This extension allows for  
Radiant to co-exist with a Rails application. You can checkout the  
code with the following command:

svn checkout svn://rubyforge.org/var/svn/radiantonrails/trunk

Or, to install the extension, follow the instructions from the  
Radiant website ([http://dev.radiantcms.org/radiant/wiki/Extensions](http://dev.radiantcms.org/radiant/wiki/Extensions))  
using the name ‘radiant\_on\_rails’ for the extension\_name.

Matt Parrish  
[http://www.pearware.org](http://www.pearware.org)

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [June 1, 2007, 6:56am UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/17 "2007-06-01T06:56:51Z")

</div>

Matt Parrish wrote:

> The RadiantOnRails extension is now live on RubyForge at http://  
> [www.rubyforge.org/projects/radiantonrails](http://www.rubyforge.org/projects/radiantonrails). This extension allows for  
> Radiant to co-exist with a Rails application. You can checkout the  
> code with the following command:
> 
> svn checkout svn://rubyforge.org/var/svn/radiantonrails/trunk
> 
> Or, to install the extension, follow the instructions from the  
> Radiant website ([http://dev.radiantcms.org/radiant/wiki/Extensions](http://dev.radiantcms.org/radiant/wiki/Extensions))  
> using the name ‘radiant\_on\_rails’ for the extension\_name.
> 
> Matt Parrish  
> [http://www.pearware.org](http://www.pearware.org)

I already have a Rails app and would like to retrofit it with Radiant  
using this extension. How would the process differ from starting with a  
Radiant app and building it out into a Rails app?

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [June 1, 2007, 9:35am UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/18 "2007-06-01T09:35:14Z")

</div>

Read through the Readme in the extension now posted on RubyForge (see  
Matt’s original post for address, etc) and you’ll find that the  
“installation” is very straight forward and will be the same whether  
it’s with a fresh Rails app or an existing one.

Give it a shot…

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [May 31, 2007, 7:34pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/19 "2007-05-31T19:34:50Z")

</div>

On May 31, 2007, at 1:14 PM, Matt Parrish wrote:

> radiant\_on\_rails

Excellent.

aiwilliams

---

<div class="post-metadata">

**Author:** ![lorenjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b5a626/32.png) [@lorenjohnson](https://www.ruby-forum.com/u/lorenjohnson)\
**Post date:** [June 1, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304/20 "2007-06-01T13:25:48Z")

</div>

You’re absolutely right, sorry I hadn’t looked closely enough.

You could gem install Radiant and generate an instance and then merge  
the necessary bits from the environment.rb it generates into your  
existing app.

If I get a chance I’ll try and determine what those necessary bits  
are later today and email back what I learn.

Loren

[Next page](https://www.ruby-forum.com/t/radiant-integration-with-another-rails-app/105304.md?page=2)
