Rails app + Radiant

Hi Folks,

Finally getting around to having a play with Radiant - looks like
it’s going to be fun. At last the CMS I’ve been waiting for: doesn’t
do much; does it well; easily extended. :slight_smile: Not sure what it is
about the Ruby community that people seem to “just get it” - more so
than the Python crowd IMHO - but there you are.

Anyway.

I keep finding myself wanting a combination of a hand-rolled rails
app with CMS. Here’s how imagine it working with Radiant:

  • Add my models and controllers to a regular radiant app.

  • Add routes to my models

  • Have my controller actions do something like

     render :controller => 'site', :action => 'show_page', ...
    

The only part I’m not getting so far is how to get the dynamic bits
into the page, e.g. the equivalent of (in regular Rails)

 @foo = ...   /   <%= @foo %>

I’m thinking either - use some kind of generic radius tag, or is
there a way of dynamically adding tags that the page can use? As you
can guess I’m completely new to the radius stuff.

Does that all make sense? How are other people doing this kind of thing?

Thanks

Tom

Tom L. wrote:

I keep finding myself wanting a combination of a hand-rolled rails
The only part I’m not getting so far is how to get the dynamic bits
into the page, e.g. the equivalent of (in regular Rails)

 @foo = ...   /   <%= @foo %>

I’m thinking either - use some kind of generic radius tag, or is
there a way of dynamically adding tags that the page can use? As you
can guess I’m completely new to the radius stuff.

Are you familiar with behaviors? If your actions aren’t too complicated
you can rewrite them as behaviors. If you need to do something custom to
the response you could override the #process method:

class MyBehavior < Behavior::Base

 def process(request, response)
   ...
 end

end

Or, if you just want to add tags to a page you can do that using the
define_tags class method:

class MyBehavior < Behavior::Base

 define_tags do
   tag "hello" do
     "hello world!"
   end
 end

end


John L.
http://wiseheartdesign.com

Are you familiar with behaviors? If your actions aren’t too
complicated
you can rewrite them as behaviors.

Thanks - I’ve just had a closer look at behaviors. For certain
things I can see how rewriting actions as behaviors would work, but
for some things, e.g. if I’ve got a few different form submissions
going on, I can imagine this getting cumbersome.

Is there a way to achieve the flow I was asking about? i.e. the
request goes to a regular action, which does its thing, then sets up
data and redirects to a radiant page?

If this is something no one has looked at yet, I’ll just get stuck in
to the source and figure out how to do it. I just wanted to check
first that I’m not reinventing the wheel. I think the idea of a rails
app with a “content managed” front end is very powerful. It certainly
hits a sweet spot for my needs.

I’m now thinking along the lines of a generic ‘rails page’ behavior,
that adds tags to the page based on data supplied from the
controller. Makes sense? Is there an easy way to communicate the data
from the controller to the behavior?

Thanks

Tom.


Or, if you just want to add tags to a page you can do that using the
define_tags class method:

Yep that would work.

Why not use Rails? Its still there…

   Erik.

Tom L. schreef:

Tom.


Erik van Oosten

On 25 Jun 2006, at 19:19, Erik van Oosten wrote:

Why not use Rails? Its still there…

From my previous post:

I think the idea of a rails app with a “content managed” front end
is very powerful.

I often need to build sites that have some “web-app” functionality,
intermingled with a lot of plain old content. It would be a huge
benefit to me if the content authors have a nice web based CMS.
They’re pretty excited about the idea too.

Tom

I often need to build sites that have some “web-app” functionality,
intermingled with a lot of plain old content. It would be a huge
benefit to me if the content authors have a nice web based CMS.
They’re pretty excited about the idea too.

Radiant is Rails. Why not build a custom controller?

Well, yes - that was what I was intending to say in my first post. I
was just after some advice as to the best way to handle the
interaction between this controller and Radiant. It looks like no one
on here has hit a need for this as yet, so I’ll have a dig around to
figure out a sensible way of achieving this. Maybe I’ll add a page to
the dev wiki with a how-to.

Tom.

Tom L. wrote:

They’re pretty excited about the idea too.
Radiant is Rails. Why not build a custom controller?


John L.