aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/base.rb3
-rw-r--r--actionpack/lib/action_controller/deprecated/base.rb12
-rw-r--r--actionpack/lib/action_controller/metal/cookies.rb1
-rw-r--r--actionpack/lib/action_controller/metal/http_authentication.rb1
-rw-r--r--actionpack/lib/action_controller/metal/renderers.rb1
-rw-r--r--actionpack/lib/action_controller/railtie.rb10
-rw-r--r--actionpack/lib/action_controller/railties/log_subscriber.rb2
-rw-r--r--actionpack/lib/action_controller/railties/url_helpers.rb6
-rw-r--r--actionpack/lib/action_controller/record_identifier.rb4
-rw-r--r--actionpack/lib/action_controller/test_case.rb11
10 files changed, 33 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 5797282b41..46a175d2fa 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -64,8 +64,7 @@ module ActionController
filter
end
- ActionController.run_base_hooks(self)
-
+ ActiveSupport.run_load_hooks(:action_controller, self)
end
end
diff --git a/actionpack/lib/action_controller/deprecated/base.rb b/actionpack/lib/action_controller/deprecated/base.rb
index bbde570ca9..2fd60aacc7 100644
--- a/actionpack/lib/action_controller/deprecated/base.rb
+++ b/actionpack/lib/action_controller/deprecated/base.rb
@@ -66,6 +66,18 @@ module ActionController
Rails.application.config.action_dispatch.ip_spoofing_check
end
+ def cookie_verifier_secret=(value)
+ ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret= is deprecated. " <<
+ "Please configure it on your application with config.cookie_secret=", caller
+ ActionController::Base.config.secret = value
+ end
+
+ def cookie_verifier_secret
+ ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret is deprecated. " <<
+ "Please use ActionController::Base.config.secret instead.", caller
+ ActionController::Base.config.secret
+ end
+
def trusted_proxies=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies= is deprecated. " <<
"Please configure it on your application with config.action_dispatch.trusted_proxies=", caller
diff --git a/actionpack/lib/action_controller/metal/cookies.rb b/actionpack/lib/action_controller/metal/cookies.rb
index 7aa687b52c..75e5d40a63 100644
--- a/actionpack/lib/action_controller/metal/cookies.rb
+++ b/actionpack/lib/action_controller/metal/cookies.rb
@@ -6,7 +6,6 @@ module ActionController #:nodoc:
included do
helper_method :cookies
- cattr_accessor :cookie_verifier_secret
end
private
diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb
index 6ec788f302..424828f7e8 100644
--- a/actionpack/lib/action_controller/metal/http_authentication.rb
+++ b/actionpack/lib/action_controller/metal/http_authentication.rb
@@ -1,4 +1,5 @@
require 'active_support/base64'
+require 'active_support/core_ext/object/blank'
module ActionController
module HttpAuthentication
diff --git a/actionpack/lib/action_controller/metal/renderers.rb b/actionpack/lib/action_controller/metal/renderers.rb
index d906e1fb5b..aebd71e867 100644
--- a/actionpack/lib/action_controller/metal/renderers.rb
+++ b/actionpack/lib/action_controller/metal/renderers.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/class/attribute'
+require 'active_support/core_ext/object/blank'
module ActionController
def self.add_renderer(key, &block)
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb
index 0ec89928af..29d8523ee1 100644
--- a/actionpack/lib/action_controller/railtie.rb
+++ b/actionpack/lib/action_controller/railtie.rb
@@ -41,7 +41,7 @@ module ActionController
log_subscriber :action_controller, ActionController::Railties::LogSubscriber.new
initializer "action_controller.logger" do
- ActionController.base_hook { self.logger ||= Rails.logger }
+ ActiveSupport.on_load(:action_controller) { self.logger ||= Rails.logger }
end
initializer "action_controller.set_configs" do |app|
@@ -53,23 +53,23 @@ module ActionController
ac.stylesheets_dir = paths.public.stylesheets.to_a.first
ac.secret = app.config.cookie_secret
- ActionController.base_hook do
+ ActiveSupport.on_load(:action_controller) do
self.config.merge!(ac)
end
end
initializer "action_controller.initialize_framework_caches" do
- ActionController.base_hook { self.cache_store ||= RAILS_CACHE }
+ ActiveSupport.on_load(:action_controller) { self.cache_store ||= RAILS_CACHE }
end
initializer "action_controller.set_helpers_path" do |app|
- ActionController.base_hook do
+ ActiveSupport.on_load(:action_controller) do
self.helpers_path = app.config.paths.app.helpers.to_a
end
end
initializer "action_controller.url_helpers" do |app|
- ActionController.base_hook do
+ ActiveSupport.on_load(:action_controller) do
extend ::ActionController::Railties::UrlHelpers.with(app.routes)
end
diff --git a/actionpack/lib/action_controller/railties/log_subscriber.rb b/actionpack/lib/action_controller/railties/log_subscriber.rb
index c2299d0b05..00ac3bdf67 100644
--- a/actionpack/lib/action_controller/railties/log_subscriber.rb
+++ b/actionpack/lib/action_controller/railties/log_subscriber.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/object/blank'
+
module ActionController
module Railties
class LogSubscriber < Rails::LogSubscriber
diff --git a/actionpack/lib/action_controller/railties/url_helpers.rb b/actionpack/lib/action_controller/railties/url_helpers.rb
index 5f95e1c621..9df5665542 100644
--- a/actionpack/lib/action_controller/railties/url_helpers.rb
+++ b/actionpack/lib/action_controller/railties/url_helpers.rb
@@ -1,14 +1,14 @@
module ActionController
module Railties
module UrlHelpers
- def self.with(router)
+ def self.with(routes)
Module.new do
define_method(:inherited) do |klass|
super(klass)
- klass.send(:include, router.url_helpers)
+ klass.send(:include, routes.url_helpers)
end
end
end
end
end
-end \ No newline at end of file
+end
diff --git a/actionpack/lib/action_controller/record_identifier.rb b/actionpack/lib/action_controller/record_identifier.rb
index 3f966b1b64..7fdaffe3eb 100644
--- a/actionpack/lib/action_controller/record_identifier.rb
+++ b/actionpack/lib/action_controller/record_identifier.rb
@@ -76,8 +76,8 @@ module ActionController
# method that replaces all characters that are invalid inside DOM ids, with valid ones. You need to
# make sure yourself that your dom ids are valid, in case you overwrite this method.
def record_key_for_dom_id(record)
- return record.id unless record.respond_to?(:to_model)
- key = record.to_model.to_key
+ record = record.to_model if record.respond_to?(:to_model)
+ key = record.to_key
key ? sanitize_dom_id(key.join('_')) : key
end
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 120f34460e..2d4cf2fafb 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -1,4 +1,5 @@
require 'rack/session/abstract/id'
+require 'active_support/core_ext/object/blank'
module ActionController
module TemplateAssertions
@@ -117,9 +118,9 @@ module ActionController
end
end
- def assign_parameters(router, controller_path, action, parameters = {})
+ def assign_parameters(routes, controller_path, action, parameters = {})
parameters = parameters.symbolize_keys.merge(:controller => controller_path, :action => action)
- extra_keys = router.extra_keys(parameters)
+ extra_keys = routes.extra_keys(parameters)
non_path_parameters = get? ? query_parameters : request_parameters
parameters.each do |key, value|
if value.is_a? Fixnum
@@ -321,7 +322,7 @@ module ActionController
def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
# Sanity check for required instance variables so we can give an
# understandable error message.
- %w(@router @controller @request @response).each do |iv_name|
+ %w(@routes @controller @request @response).each do |iv_name|
if !(instance_variable_names.include?(iv_name) || instance_variable_names.include?(iv_name.to_sym)) || instance_variable_get(iv_name).nil?
raise "#{iv_name} is nil: make sure you set it in your test's setup method."
end
@@ -337,7 +338,7 @@ module ActionController
@request.env['REQUEST_METHOD'] = http_method
parameters ||= {}
- @request.assign_parameters(@router, @controller.class.name.underscore.sub(/_controller$/, ''), action.to_s, parameters)
+ @request.assign_parameters(@routes, @controller.class.name.underscore.sub(/_controller$/, ''), action.to_s, parameters)
@request.session = ActionController::TestSession.new(session) unless session.nil?
@request.session["flash"] = @request.flash.update(flash || {})
@@ -446,7 +447,7 @@ module ActionController
:relative_url_root => nil,
:_path_segments => @request.symbolized_path_parameters)
- url, query_string = @router.url_for(options).split("?", 2)
+ url, query_string = @routes.url_for(options).split("?", 2)
@request.env["SCRIPT_NAME"] = @controller.config.relative_url_root
@request.env["PATH_INFO"] = url