SiteController sessions and flash access

All,

  1. I read in this post from back in '08
    (http://www.ruby-forum.com/topic/142224) that the SiteController had
    sessions disabled by default.

Sessions are enabled in my SiteController (which is good, since I am
doing lots of user-centric stuff). When did that change in the base
Radiant install (or did I turn them on and not remember doing it).

  1. I would like to take advantage of the flash for standard
    informational messages in my UI. But there is no built-in access to the
    flash. Has anyone built a tag to access the flash and would you be
    willing to share it?

Thanks,
Wes

My new <r:flash/> tag - perhaps it is of some use:

desc %{
   Returns the requested element of the flash for use in layout/page

display.

   *Usage:*
 }

 tag "flash" do |tag|
   if key = tag.attr['key']
     flash =

tag.locals.page.response.template.controller.session[‘flash’]
flash ? (flash[key] || flash[key.to_sym] || ‘’) : ‘’
else
raise TagError.new(“flash' tag must containkey’ attribute”)
end
end

flash[] with :notice, :error, :success keys are already in use by the
radiant admin.
So if you have a user logged into admin and into you custom auth, you
will get msg’s meant for admin interface appear on user side and vice
versa.
This, of course, may be something you that you do want or you dont.

For now, I am counting on admin. types (which are us) to be mindful
enough to not be logged into user side.

If I have to, I can add admin. logout logic as a before_filter on the
SiteController, and user logout logic as a before filter on the admin
side of things.

W

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs