[Radiant] Redirect hell
John W. Long
ng at johnwlong.com
Fri Sep 1 11:51:45 CDT 2006
Sean Cribbs wrote:
> John et al,
>
> I think I'm in the final step of creating my Commentable/CommentBucket
> behaviors before releasing them into the wild, but I've found that I'm
> getting into an endless redirect loop after most of my process method
> finishes (I want to potentially redirect back to the same page, but without
> the post). How can I avoid this endless loop? I tried nullifying the
> request and response objects. Is the redirect itself getting cached?
You should definately turn caching off:
def cache_page?
false
end
When working with forms on pages, I like to use request.post? to check
process a posted form. Here's and excerpt from a behavior I wrote for
Ruby-Lang.org:
def render_page
if request.post?
@list = List.lookup(params[:list] || 'ruby-talk')
@first_name = get_param(:first_name)
@last_name = get_param(:last_name)
@email = get_param(:email)
@action = get_param(:action).downcase
...
@success = true
else
@success = false
end
super
end
--
John Long
http://wiseheartdesign.com
More information about the Radiant
mailing list