Skip to content

Instantly share code, notes, and snippets.

@caffo
Created March 20, 2009 21:54
Show Gist options
  • Save caffo/82602 to your computer and use it in GitHub Desktop.
Save caffo/82602 to your computer and use it in GitHub Desktop.
module ActionControllerExtensions
def self.included(base)
base::Dispatcher.send :include, DispatcherExtensions
end
module DispatcherExtensions
def self.included(base)
base.send :before_dispatch, :set_session_domain
end
def set_session_domain
ApplicationController.session_options.update :session_domain => "#{@request.host.gsub(/^[^.]*/, '')}" unless request.host.match /\.localhost$/
end
end
end
ActionController.send :include, ActionControllerExtensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment