rails/init.rb in has_global_session-0.8.0 vs rails/init.rb in has_global_session-0.8.1
- old
+ new
@@ -1,18 +1,21 @@
basedir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
require File.join(basedir, 'lib', 'has_global_session')
-# Tie the Configuration module to Rails' filesystem structure
-# and operating environment.
-HasGlobalSession::Configuration.config_file =
- File.join(RAILS_ROOT, 'config', 'global_session.yml')
-HasGlobalSession::Configuration.environment = RAILS_ENV
+config_file = File.join(RAILS_ROOT, 'config', 'global_session.yml')
-require File.join(basedir, 'rails', 'action_controller_instance_methods')
+if File.exist?(config_file)
+ # Tie the Configuration module to Rails' filesystem structure
+ # and operating environment.
+ HasGlobalSession::Configuration.config_file = config_file
+ HasGlobalSession::Configuration.environment = RAILS_ENV
-# Enable ActionController integration.
-class ActionController::Base
- def self.has_global_session
- include HasGlobalSession::ActionControllerInstanceMethods
- after_filter :global_session_update_cookie
+ require File.join(basedir, 'rails', 'action_controller_instance_methods')
+
+ # Enable ActionController integration.
+ class ActionController::Base
+ def self.has_global_session
+ include HasGlobalSession::ActionControllerInstanceMethods
+ after_filter :global_session_update_cookie
+ end
end
-end
+end
\ No newline at end of file