Flash/Flex Remoting and Disabling Rails Sessions
The things that make web development with Ruby on Rails so easy, and dare I say fun, can also sometimes get in the way or cause unexpected problems (not fun). Rails sessions are generated automatically which is cool if you need sessions for say a shopping cart app. However if you don’t need sessions, or you want to handle data tracking in a different way with Flex/Flash’s Shared Objects, Rails will still chug along and output a session unless you tell it not to.
Here’s how to stop the session madness. Open up the WebORB controller and add this line ‘session :disabled => true‘.
class WeborbController < ApplicationController
session :disabled => true
This is not Remoting specific and works for any controller in a Rails app. Rails sessions will keep multiplying like those furry things from that infamous Star Trek episode (Tribbles, thanks Google). eventually you’ll need a CRON job on your server to delete sessions from the tmp/sessions folder (or the database if you’re using ActiveRecord Store), so you might as well not create them in the first place and avoid a mess to clean up!
Here’s a good article on Rails sessions.
This entry was written by
Alastair, posted on
September 20, 2006 at 4:06 pm, filed under
Flash,
Flex,
Ruby on Rails. Bookmark the
permalink. Follow any comments here with the
RSS feed for this post.
or leave a trackback:
Trackback URL.
© Copyright 2006 - 2012 Alastair Dawson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.