Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Base setup for config object in AC.

  • Loading branch information...
commit 60cc86136bffc96bc62798538e08e0d28138d41c 1 parent 55ae53b
@wycats wycats authored
View
1  actionpack/lib/action_controller.rb
@@ -2,6 +2,7 @@ module ActionController
autoload :Base, "action_controller/base"
autoload :Benchmarking, "action_controller/metal/benchmarking"
autoload :ConditionalGet, "action_controller/metal/conditional_get"
+ autoload :Configuration, "action_controller/metal/configuration"
autoload :Helpers, "action_controller/metal/helpers"
autoload :HideActions, "action_controller/metal/hide_actions"
autoload :Layouts, "action_controller/metal/layouts"
View
1  actionpack/lib/action_controller/base.rb
@@ -15,6 +15,7 @@ class Base < Metal
include ActionController::ConditionalGet
include ActionController::RackConvenience
include ActionController::Benchmarking
+ include ActionController::Configuration
# Legacy modules
include SessionManagement
View
28 actionpack/lib/action_controller/metal/configuration.rb
@@ -0,0 +1,28 @@
+module ActionController
+ module Configuration
+ extend ActiveSupport::Concern
+
+ def config
+ @config ||= self.class.config
+ end
+
+ def config=(config)
+ @config = config
+ end
+
+ module ClassMethods
+ def default_config
+ @default_config ||= {}
+ end
+
+ def config
+ self.config ||= default_config
+ end
+
+ def config=(config)
+ @config = ActiveSupport::OrderedHash.new
+ @config.merge!(config)
+ end
+ end
+ end
+end
View
15 actionpack/lib/action_controller/metal/session_management.rb
@@ -1,10 +1,8 @@
module ActionController #:nodoc:
module SessionManagement #:nodoc:
- def self.included(base)
- base.class_eval do
- extend ClassMethods
- end
- end
+ include ActiveSupport::Concern
+
+ include ActionController::Configuration
module ClassMethods
# Set the session store to be used for keeping the session data between requests.
@@ -35,13 +33,6 @@ def session=(options = {})
session_options.merge!(options)
end
- # Returns the hash used to configure the session. Example use:
- #
- # ActionController::Base.session_options[:secure] = true # session only available over HTTPS
- def session_options
- @session_options ||= {}
- end
-
def session(*args)
ActiveSupport::Deprecation.warn(
"Disabling sessions for a single controller has been deprecated. " +
Please sign in to comment.
Something went wrong with that request. Please try again.