# SiteController sessions and flash access

**URL:** <https://www.ruby-forum.com/t/sitecontroller-sessions-and-flash-access/197884>\
**Category:** Radiant CMS\
**Created:** [October 21, 2010, 11:22pm UTC](https://www.ruby-forum.com/t/sitecontroller-sessions-and-flash-access/197884 "2010-10-21T23:22:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [October 21, 2010, 11:22pm UTC](https://www.ruby-forum.com/t/sitecontroller-sessions-and-flash-access/197884/1 "2010-10-21T23:22:32Z")

</div>

All,

1. I read in this post from back in '08  
([Accessing Flash/Session in Radiant Tags? - Radiant CMS - Ruby-Forum](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

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [October 21, 2010, 11:55pm UTC](https://www.ruby-forum.com/t/sitecontroller-sessions-and-flash-access/197884/2 "2010-10-21T23:55:56Z")

</div>

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 contain`key’ attribute”)  
end  
end

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [October 22, 2010, 1:32am UTC](https://www.ruby-forum.com/t/sitecontroller-sessions-and-flash-access/197884/3 "2010-10-22T01:32:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [October 22, 2010, 1:39am UTC](https://www.ruby-forum.com/t/sitecontroller-sessions-and-flash-access/197884/4 "2010-10-22T01:39:16Z")

</div>

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
