diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-04 11:58:30 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-03-04 11:58:30 -0800 |
commit | 17769696279810c6c24a10b0d47f9b712205f0ce (patch) | |
tree | 86093a3cfed5e3bcac393284f79b4f9c046d0250 /actionpack/lib/action_controller | |
parent | c0c1599fb15fa4bb9f311c92c88d7c83795388fb (diff) | |
download | rails-17769696279810c6c24a10b0d47f9b712205f0ce.tar.gz rails-17769696279810c6c24a10b0d47f9b712205f0ce.tar.bz2 rails-17769696279810c6c24a10b0d47f9b712205f0ce.zip |
Move session and session_store onto ActionDispatch and add deprecation warnings
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/compatibility.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/session_management.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 50 |
3 files changed, 39 insertions, 22 deletions
diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 4c2136de8a..024c58ffc4 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -158,6 +158,12 @@ module ActionController Rails.application.config.action_dispatch.ip_spoofing_check = value end + def session=(value) + ActiveSupport::Deprecation.warn "ActionController::Base.session= is deprecated. " << + "Please configure it on your application with config.action_dispatch.session=", caller + Rails.application.config.action_dispatch.session = value.delete(:disabled) ? nil : value + end + def rescue_action(env) raise env["action_dispatch.rescue.exception"] end diff --git a/actionpack/lib/action_controller/metal/session_management.rb b/actionpack/lib/action_controller/metal/session_management.rb index ce8b20964b..1ea22b7b28 100644 --- a/actionpack/lib/action_controller/metal/session_management.rb +++ b/actionpack/lib/action_controller/metal/session_management.rb @@ -27,11 +27,6 @@ module ActionController #:nodoc: SessionManagement.session_store_for(config.session_store) end - def session=(options = {}) - self.session_store = nil if options.delete(:disabled) - session_options.merge!(options) - end - def session(*args) ActiveSupport::Deprecation.warn( "Disabling sessions for a single controller has been deprecated. " + diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 3a084cdf67..031df9423f 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -3,6 +3,7 @@ require "action_controller" require "action_view/railtie" require "active_support/core_ext/class/subclasses" require "active_support/deprecation/proxy_wrappers" +require "active_support/deprecation" module ActionController class Railtie < Rails::Railtie @@ -11,33 +12,48 @@ module ActionController require "action_controller/railties/log_subscriber" require "action_controller/railties/url_helpers" - log_subscriber ActionController::Railties::LogSubscriber.new + ad = config.action_dispatch + config.action_controller.singleton_class.send(:define_method, :session) do + ActiveSupport::Deprecation.warn "config.action_controller.session has been " \ + "renamed to config.action_dispatch.session.", caller + ad.session + end - config.action_controller.session_store = :cookie_store - config.action_controller.session_options = {} + config.action_controller.singleton_class.send(:define_method, :session=) do |val| + ActiveSupport::Deprecation.warn "config.action_controller.session has been " \ + "renamed to config.action_dispatch.session.", caller + ad.session = val + end - initializer "action_controller.logger" do - ActionController::Base.logger ||= Rails.logger + config.action_controller.singleton_class.send(:define_method, :session_store) do + ActiveSupport::Deprecation.warn "config.action_controller.session_store has been " \ + "renamed to config.action_dispatch.session_store.", caller + ad.session_store end - # assets_dir = defined?(Rails.public_path) ? Rails.public_path : "public" - # ActionView::DEFAULT_CONFIG = { - # :assets_dir => assets_dir, - # :javascripts_dir => "#{assets_dir}/javascripts", - # :stylesheets_dir => "#{assets_dir}/stylesheets", - # } + config.action_controller.singleton_class.send(:define_method, :session_store=) do |val| + ActiveSupport::Deprecation.warn "config.action_controller.session_store has been " \ + "renamed to config.action_dispatch.session_store.", caller + ad.session_store = val + end + log_subscriber ActionController::Railties::LogSubscriber.new + + initializer "action_controller.logger" do + ActionController::Base.logger ||= Rails.logger + end initializer "action_controller.set_configs" do |app| paths = app.config.paths ac = app.config.action_controller - ac.assets_dir = paths.public - ac.javascripts_dir = paths.public.javascripts - ac.stylesheets_dir = paths.public.stylesheets + ac.assets_dir = paths.public.to_a.first + ac.javascripts_dir = paths.public.javascripts.to_a.first + ac.stylesheets_dir = paths.public.stylesheets.to_a.first - app.config.action_controller.each do |k,v| - ActionController::Base.send "#{k}=", v - end + ActionController::Base.config.replace(ac) + # app.config.action_controller.each do |k,v| + # ActionController::Base.send "#{k}=", v + # end end initializer "action_controller.initialize_framework_caches" do |