Vixiom Axioms

September 20, 2006

Flash/Flex Remoting and Disabling Rails Sessions

Filed under: Flash, Flex, Ruby on Rails Alastair @ 4:06 pm

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.

Digg! submit Flash/Flex Remoting and Disabling Rails Sessions to stumbleupon.com submit Flash/Flex Remoting and Disabling Rails Sessions to del.icio.us submit Flash/Flex Remoting and Disabling Rails Sessions to reddit.com Like this post? subscribe to the feed.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image

Powered by WordPress