From da65320433088548bc4cff33758e5acd71fd137a Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 14 May 2009 17:25:10 -0700 Subject: Got new base to pass controller/base_test.rb, implemented method_missing action semantics in compatibility mode, and fixed a few action_missing bugs. --- .../lib/action_controller/new_base/compatibility.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actionpack/lib/action_controller/new_base/compatibility.rb') diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb index d17f498b60..993e571aba 100644 --- a/actionpack/lib/action_controller/new_base/compatibility.rb +++ b/actionpack/lib/action_controller/new_base/compatibility.rb @@ -42,6 +42,9 @@ module ActionController # Controls the resource action separator cattr_accessor :resource_action_separator self.resource_action_separator = "/" + + cattr_accessor :use_accept_header + self.use_accept_header = true end module ClassMethods @@ -66,6 +69,18 @@ module ActionController super end + + def respond_to_action?(action_name) + if respond_to?(:method_missing) && !respond_to?(:action_missing) + self.class.class_eval do + private + def action_missing(name, *args) + method_missing(name.to_sym, *args) + end + end + end + super + end def _layout_for_name(name) name &&= name.sub(%r{^/?layouts/}, '') -- cgit v1.2.3 From 7e10504bdeab14ea70a942110a1b1ef6d8467ed3 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Fri, 15 May 2009 15:57:12 -0700 Subject: Refactored AbstractController to provide better hook points for overriding aspects of action dispatching --- .../lib/action_controller/new_base/compatibility.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'actionpack/lib/action_controller/new_base/compatibility.rb') diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb index 993e571aba..9884ed12e5 100644 --- a/actionpack/lib/action_controller/new_base/compatibility.rb +++ b/actionpack/lib/action_controller/new_base/compatibility.rb @@ -69,17 +69,13 @@ module ActionController super end - - def respond_to_action?(action_name) - if respond_to?(:method_missing) && !respond_to?(:action_missing) - self.class.class_eval do - private - def action_missing(name, *args) - method_missing(name.to_sym, *args) - end - end - end - super + + def _handle_method_missing + method_missing(@_action_name.to_sym) + end + + def method_for_action(action_name) + super || (respond_to?(:method_missing) && "_handle_method_missing") end def _layout_for_name(name) -- cgit v1.2.3 From 5a45446cff0daf4ca747257a8779dcd5d9cae1d7 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Fri, 15 May 2009 17:49:11 -0700 Subject: Ported Rescuable to new base --- actionpack/lib/action_controller/new_base/compatibility.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionpack/lib/action_controller/new_base/compatibility.rb') diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb index 9884ed12e5..0a283887b6 100644 --- a/actionpack/lib/action_controller/new_base/compatibility.rb +++ b/actionpack/lib/action_controller/new_base/compatibility.rb @@ -45,6 +45,14 @@ module ActionController cattr_accessor :use_accept_header self.use_accept_header = true + + cattr_accessor :page_cache_directory + self.page_cache_directory = defined?(Rails.public_path) ? Rails.public_path : "" + + cattr_reader :cache_store + + cattr_accessor :consider_all_requests_local + self.consider_all_requests_local = true end module ClassMethods @@ -53,6 +61,11 @@ module ActionController def rescue_action(env) raise env["action_dispatch.rescue.exception"] end + + # Defines the storage option for cached fragments + def cache_store=(store_option) + @@cache_store = ActiveSupport::Cache.lookup_store(store_option) + end end def initialize(*) -- cgit v1.2.3