diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-11 14:48:58 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-11 14:48:58 -0700 |
commit | 0f6e764e4060b75ea8a335e6971209a08bf8b40a (patch) | |
tree | 8907c891ac1b067036f636fa23948fcec0383800 /actionpack | |
parent | 6694bd46f59eb9b9b23afbd0d9484fd87e8fe350 (diff) | |
download | rails-0f6e764e4060b75ea8a335e6971209a08bf8b40a.tar.gz rails-0f6e764e4060b75ea8a335e6971209a08bf8b40a.tar.bz2 rails-0f6e764e4060b75ea8a335e6971209a08bf8b40a.zip |
Fixed a bug with handling render options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/new_base/compatibility.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_controller/new_base/renderer.rb | 4 | ||||
-rw-r--r-- | actionpack/test/abstract_unit2.rb | 65 |
3 files changed, 12 insertions, 66 deletions
diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb index b6e15a4e0d..505675ec4d 100644 --- a/actionpack/lib/action_controller/new_base/compatibility.rb +++ b/actionpack/lib/action_controller/new_base/compatibility.rb @@ -23,6 +23,15 @@ module ActionController cattr_accessor :default_charset self.send(:class_variable_set, "@@default_charset", "utf-8") + + cattr_reader :protected_instance_variables + self.send(:class_variable_set, "@@protected_instance_variables", %w(@assigns @performed_redirect @performed_render @variables_added @request_origin @url @parent_controller + @action_name @before_filter_chain_aborted @action_cache_path @_headers @_params + @_flash @_response)) + end + + module ClassMethods + def protect_from_forgery() end end def render_to_body(options) diff --git a/actionpack/lib/action_controller/new_base/renderer.rb b/actionpack/lib/action_controller/new_base/renderer.rb index 4c4a74979b..bedd1d7a23 100644 --- a/actionpack/lib/action_controller/new_base/renderer.rb +++ b/actionpack/lib/action_controller/new_base/renderer.rb @@ -23,8 +23,8 @@ module ActionController options[:_template] = template elsif options.key?(:template) options[:_template_name] = options[:template] - elsif options.key?(:action) - options[:_template_name] = options[:action].to_s + else + options[:_template_name] = (options[:action] || action_name).to_s options[:_prefix] = _prefix end diff --git a/actionpack/test/abstract_unit2.rb b/actionpack/test/abstract_unit2.rb index 680043fab0..95e7b2e273 100644 --- a/actionpack/test/abstract_unit2.rb +++ b/actionpack/test/abstract_unit2.rb @@ -74,71 +74,8 @@ module ActionController class UnknownHttpMethod < ActionControllerError #:nodoc: end - class Base < Http - abstract! - # <HAX> - cattr_accessor :relative_url_root - self.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT'] - - cattr_reader :protected_instance_variables - # Controller specific instance variables which will not be accessible inside views. - @@protected_instance_variables = %w(@assigns @performed_redirect @performed_render @variables_added @request_origin @url @parent_controller - @action_name @before_filter_chain_aborted @action_cache_path @_headers @_params - @_flash @_response) - # </HAX> - - use AbstractController::Callbacks - use AbstractController::Helpers - use AbstractController::Logger - - use ActionController::HideActions - use ActionController::UrlFor - use ActionController::Renderer - use ActionController::Layouts - use ActionController::Rails2Compatibility + class Base use ActionController::Testing - - def self.protect_from_forgery() end - - def self.inherited(klass) - ::ActionController::Base.subclasses << klass.to_s - super - end - - def self.subclasses - @subclasses ||= [] - end - - def self.app_loaded! - @subclasses.each do |subclass| - subclass.constantize._write_layout_method - end - end - - def render(action = action_name, options = {}) - if action.is_a?(Hash) - options, action = action, nil - else - options.merge! :action => action - end - - super(options) - end - - def render_to_body(options = {}) - options = {:template => options} if options.is_a?(String) - super - end - - def process_action - ret = super - render if response_body.nil? - ret - end - - def respond_to_action?(action_name) - super || view_paths.find_by_parts?(action_name.to_s, {:formats => formats, :locales => [I18n.locale]}, controller_path) - end end Base.view_paths = FIXTURE_LOAD_PATH |