# Dynamic pages strategies?

**URL:** <https://www.ruby-forum.com/t/dynamic-pages-strategies/102338>\
**Category:** Radiant CMS\
**Created:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338 "2006-08-15T14:15:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/1 "2006-08-15T14:15:15Z")

</div>

I’ve been following the development of a few Rails CMS/blog engines  
and so far I really like Radiant but I can’t quite figure out the best  
strategy to implement dynamic pages like contact/registration forms.  
Maybe I’m missing the obvious but how would you go about generating a  
registration form (with validation errors, thank you message and all):

- Generate a clean registration object and save it into the session.
- Create tags that pull the registration info from the session.
- Process the post in a controller outside Radiant and return  
processed data to the session.

Is that how you would do it? Or do I need another pure Rails site  
([forms.domain.com](http://forms.domain.com)) to process dynamic data?

Sorry but I’m confused. Most of the site I would use Radiant for are  
mostly content but always have one or two forms that are always  
around. I would really apreciate your ideas on getting the best of  
both worlds.

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/2 "2006-08-15T14:15:16Z")

</div>

This seems to be a case where you would create a custom behavior that  
generates the form, then a controller it can post to. Of course, you  
would  
have to change the routes file as well to handle the special controller.  
Radiant is designed with the content as the core and it does that very  
well. Good luck finding what you need!

Sean C.  
[seancribbs.com](http://seancribbs.com)

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/3 "2006-08-15T14:15:18Z")

</div>

I think that creating a form on a page and giving that page a custom  
form behavior is probably good enough. You can use the behavior to  
handle the form posting. Look at how the FormMailer behavior works.

Josh

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/4 "2006-08-15T14:15:19Z")

</div>

Sean,

Thanks for the info. After looking at routes.rb I see what you mean.  
I’ll do more digging.

Sincerely,

Adrian M.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/5 "2006-08-15T14:15:19Z")

</div>

John,

Thanks for the pointer. I’ll check that out.

Sincerely,

Adrian M.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/6 "2006-08-15T14:15:20Z")

</div>

Adrian M. wrote:

> Is that how you would do it? Or do I need another pure Rails site  
> ([forms.domain.com](http://forms.domain.com)) to process dynamic data?

One way to do this is to use a behavior. Matt McCray has created a  
Mailer behavior which might do what you want:

[http://mattmccray.com/svn/rails/plugins/radiant\_mailer\_behavior/](http://mattmccray.com/svn/rails/plugins/radiant_mailer_behavior/)

If this proves difficult the [forms.domain.com](http://forms.domain.com) approach might work well  
for you.

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

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 16, 2006, 7:57pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/7 "2006-08-16T19:57:39Z")

</div>

John et al,

Thanks to everybody for the ideas and pointers. since I found a way to  
do a  
simple registration form I thought I should report on my findings. I  
have  
attached the behavior just in case it can help anybody out there. It is  
heavily modeled after (read ripped from) the Mailer behavior. BTW, the  
Mailer ehavior has some nice general form creation tags although I  
wonder  
if/how to use the builtin Rails helpers for that. Anyway, here’s how I  
use  
it:

# Register Page

## body

## 

Register with us

  
  
  
\<r:registration:form name=“register”\>  
\<r:errors /\>  
\<r:success /\>  
First Name:  
\<r:text name=“first\_name” /\>  
  
Last Name:  
\<r:text name=“last\_name” /\>  
  
Phone:  
\<r:text name=“phone” /\>  
  
Email:  
\<r:text name=“email” /\>  
  
Subscribe:  
\<r:checkbox name=“subscribed” value=“1”  
/\>  
  
Comments:  
\<r:textarea name=“comments” /\>  
  
  
\<r:submit value=“Register” /\>  
  
  
\<r:debug /\>  
  
\</r:registration:form\>  
  
  
  

## config

registrations:  
register:  
redirect\_to: /register/thank-you

The only real problem I faced was that I could not get the behavior to  
respect process() (it would not run by any means). So I moved to using a  
before filter to process the POST but I still cannot redirect after  
processing. I’m sure I am missing something but the original Mailer  
bahavior  
would not send emails either or bark about it. BTW, I’m running this on  
0.5.2 unpacked. For me redirecting sometimes is a requirement so if  
anybody  
has any ideas on why it is not working please let me know.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 22, 2006, 4:17pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/8 "2006-08-22T16:17:41Z")

</div>

Hi all,  
I want a page where the content can be find from a search page.

root  
 → agenda  
 → contact1  
 → contact2

In agenda a want find the contact by city, name, etc.  
I think tha cantac page like this:  
\<r:my\_tag\_name\>name 1\</r:my\_tag\_name\>  
\<r:my\_tag\_city\>name 1\</r:my\_tag\_city\>

For create tag I think to use:  
[http://radiantcms.org/blog/2006/05/03/generating-and-testing-behaviors/](http://radiantcms.org/blog/2006/05/03/generating-and-testing-behaviors/)  
Better way?

The search (in agenda) can separate alphabetical, by city etc  
in one or more field.  
I think to use the good  
[http://nobits.org/articles/2006/06/10/radiant-search-behaviour/](http://nobits.org/articles/2006/06/10/radiant-search-behaviour/)  
but the search will be extended to all the site.

I also see this post that maybe can talk of similar problem:

- [http://lists.radiantcms.org/pipermail/radiant/2006-August/001255.html](http://lists.radiantcms.org/pipermail/radiant/2006-August/001255.html)
- [http://lists.radiantcms.org/pipermail/radiant/2006-August/001275.html](http://lists.radiantcms.org/pipermail/radiant/2006-August/001275.html)
- this topic, of course

So, out of my problem, an idea can be build a Behaviour for add CRUD  
page  
(new table in the db) and admin’s page for the public face of radiant.  
So we can have:  
a Public section  
an Admin (developer) section  
a admin (site) section

I think radiant is already fantastic.  
With this behavior maybe can be a paradise’s app  
Any comment?

I’am a newbie and it’s always only an idea (at the moment).  
whichever thing happens compliments at all for tha moment.  
Lucio

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 22, 2006, 11:01pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/9 "2006-08-22T23:01:54Z")

</div>

Lucio wrote:

> With this behavior maybe can be a paradise’s app  
> Any comment?

Lucio, I’m having trouble understanding your question. Are you wondering  
if it is possible to add fields to the Page class? If so the answer is  
yes, you can do it with the Rails plugin system, but it may be  
difficult. The plugin system doesn’t make it easy to modify models or  
views, but it can be done.

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

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 22, 2006, 11:21pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/10 "2006-08-22T23:21:21Z")

</div>

John W. Long wrote:

> Lucio wrote:
> 
> > With this behavior maybe can be a paradise’s app  
> > Any comment?
> 
> Lucio, I’m having trouble understanding your question. Are you wondering  
> if it is possible to add fields to the Page class? If so the answer is  
> yes, you can do it with the Rails plugin system, but it may be  
> difficult. The plugin system doesn’t make it easy to modify models or  
> views, but it can be done.
> 
> –  
> John L.  
> [http://wiseheartdesign.com](http://wiseheartdesign.com)

my problem is not insert the search’s field  
but, if possible, select the values in my tags

\<r:my\_tag\>value to select by search\</r:my\_tag\>

Thanks in advanced.  
L.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 22, 2006, 11:27pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/11 "2006-08-22T23:27:56Z")

</div>

lucio wrote:

> my problem is not insert the search’s field  
> but, if possible, select the values in my tags
> 
> \<r:my\_tag\>value to select by search\</r:my\_tag\>

So you want to be able to define custom strings inside of page parts  
that will be indexed by the search engine? That would be quite  
complicated, I’m not sure what to recommend.

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

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 15, 2006, 2:15pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/12 "2006-08-15T14:15:26Z")

</div>

John,

Thanks for the info. Josh recommended the same and I’m checking it  
out. I will post again once I have figured it out.

Thanks!

Adrian M.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 25, 2006, 11:30am UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/13 "2006-08-25T11:30:28Z")

</div>

On 8/16/06, Adrian M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The only real problem I faced was that I could not get the behavior to  
> respect process() (it would not run by any means). So I moved to using a  
> before filter to process the POST but I still cannot redirect after  
> processing. I’m sure I am missing something but the original Mailer bahavior  
> would not send emails either or bark about it. BTW, I’m running this on  
> 0.5.2 unpacked. For me redirecting sometimes is a requirement so if anybody  
> has any ideas on why it is not working please let me know.

I have run in to the same issue (Mailer not sending mail, or not  
redirecting to thank you page). I have stopped using it for now (until  
I have time to take care of that - I want to also build feedback into  
my 404 page, so people can tell me about broken links with just a  
click or so.).

I had trouble too with getting filters to run. In the end,  
process(request, response) did the trick, whereas the other’s just  
refused to do anything. I wonder why.

How do people debug the behaviors, especially when it is running as a  
plugin? I didn’t find a logger object to use within the behavior  
(maybe there is one, who knows?), Doing print statements only works  
inside the test runs, and not under tail -f development.log, or even  
the Webrick screen. I had some serious time burnt due to this, until I  
resorted to using ./script/breakpointer. Sometimes too, you get an  
error message trapped nicely for you by Radiant and you just want to  
know what line caused it, but it’s not so easy as it could be.

What’s the secret sauce? And does Mailer work for everyone, except maybe  
me? 🙂

– G.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 25, 2006, 1:02pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/14 "2006-08-25T13:02:38Z")

</div>

On 8/25/06, Bodhi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def logger  
> ActiveRecord::Base.logger  
> end

Is there any reason this is not in the base class (i.e. built into all  
behaviors)?

Just curious 🙂

– G.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 25, 2006, 12:42pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/15 "2006-08-25T12:42:36Z")

</div>

On Aug 25, 2006, at 6:29 PM, Guido S. wrote:

> On 8/16/06, Adrian M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
> How do people debug the behaviors, especially when it is running as a  
> plugin? I didn’t find a logger object to use within the behavior  
> (maybe there is one, who knows?), Doing print statements only works  
> inside the test runs, and not under tail -f development.log, or even  
> the Webrick screen. I had some serious time burnt due to this, until I  
> resorted to using ./script/breakpointer. Sometimes too, you get an  
> error message trapped nicely for you by Radiant and you just want to  
> know what line caused it, but it’s not so easy as it could be.

You can do something like:

def logger  
ActiveRecord::Base.logger  
end

in your behaviour to get access to a logger while testing…

> What’s the secret sauce? And does Mailer work for everyone, except  
> maybe me? 🙂

It was working for me, but I had hacked it up to do some other things  
(like store inquiries in the database).

I dont have a lot of time to look into it right now though ☹

Bodhi

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 26, 2006, 10:55am UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/16 "2006-08-26T10:55:50Z")

</div>

Guido,

Mailer does not work for me. On the logging I always use:

RAILS\_DEFAULT\_LOGGER.debug “xyz”

That always work on rails. I still can’t get it to redirect and using  
that  
logger I can say that the process method never gets called in my  
behavior.

Sincerely,

Adrian M.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [August 26, 2006, 12:02pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/17 "2006-08-26T12:02:56Z")

</div>

Has anyone gotten the Mailer Behavior to work on dreamhost? I am  
trying to get an app up and running there and it is important that  
the forms work. Right now, I just have a “protected method  
`get\_class\_name’ called for #” error. I am on a pretty tight schedule  
so any help would be appreciated…

Keith B.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [September 4, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/18 "2006-09-04T14:46:14Z")

</div>

Keith B. wrote:

> Has anyone gotten the Mailer Behavior to work on dreamhost? I am trying  
> to get an app up and running there and it is important that the forms  
> work. Right now, I just have a “protected method `get\_class\_name’ called  
> for #” error. I am on a pretty tight schedule so any help would be  
> appreciated…

If you need something fast on the forms end you might try wufoo:

> **[Online Form Builder with Cloud Storage Database | Wufoo](https://www.wufoo.com/)**
>
> Wufoo's online form builder helps you create custom forms in minutes. Use Wufoo to create registration forms, application forms, surveys, contact forms, payment forms and more. Sign up free!

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

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [September 4, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/19 "2006-09-04T14:46:30Z")

</div>

It is not working for me too. I attempted to push for a mailer  
behavior fix in several posts on this list but nothing yet, so far …  
☹ Unfortunately I’m not in the condition to attempt a fix by myself  
at the time being.

---

<div class="post-metadata">

**Author:** ![cvcomp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@cvcomp](https://www.ruby-forum.com/u/cvcomp)\
**Post date:** [September 4, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338/20 "2006-09-04T14:46:34Z")

</div>

On Aug 27, 2006, at 11:41 AM, Maurizio B. wrote:

> It is not working for me too. I attempted to push for a mailer  
> behavior fix in several posts on this list but nothing yet, so far …  
> ☹ Unfortunately I’m not in the condition to attempt a fix by myself  
> at the time being.

Just working on something else and i noticed in line 19 of config/  
environment.rb has:

config.frameworks -= [:action\_web\_service, :action\_mailer]

try changing it to

config.frameworks -= [:action\_web\_service]

and see if that fixes it. Also, i think it says on the wiki that the  
mailer behaviour needs the Radiant behavior filters plugin, but i  
vaguely remember that if you actually install the plugin, it breaks  
the mailer behaviour!

Bodhi

[Next page](https://www.ruby-forum.com/t/dynamic-pages-strategies/102338.md?page=2)
