The scenerio is this:

The Comments extension has a controller that handles the comment form
and then redirects the request back to the originating Page (with the
comment now saved).  The form requires an email address, but at the
moment, when no email address is supplied, one just gets the classic
ugly Rails error page (with stack).

The trouble is that because of the redirect, the CommentController
cannot use the typical Rails validation code to display validation
error messages.  My thought was to try and fix this by stuffing the
error message into the controller `flash` or the session.  But there
doesn't appear to be any way to access flash from inside a tag.  It's
not part of the tag.globals or tag.locals.  Fixing this would require
patching the SiteController.

So my questions are:

   1) Is there any other way to access the flash or session data from
      a tag?

   2) Is there a better way to send back form validation messages to a
      Page? (*)

If not, I'll send a patch to the SiteController to bind the flash to a
the tag object.

(*) -- The Mailer extension gets around this problem by subclassing
the Page object, but that seems like a less than ideal approach since
at the moment, any type of Page can have comments, whereas subclassing
removes that option.

Thanks!

-- 
  J Aaron Farr     jadetower.com        [US] +1 724-964-4515
    馮傑仁         cubiclemuses.com     [HK] +852 8123-7905
_______________________________________________
Radiant mailing list
Post:   Radiant@lists.radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to