diff options
Diffstat (limited to 'actionpack/lib')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 12 |
2 files changed, 15 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index be04012b9f..225a61f43e 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -637,10 +637,11 @@ module ActionController #:nodoc: end def render_action(action_name, status = nil, with_layout = true) - if with_layout - render_with_layout(default_template_name(action_name), status) + template = default_template_name(action_name) + if with_layout && !template_exempt_from_layout?(template) + render_with_layout(template, status) else - render_with_no_layout(default_template_name(action_name), status) + render_without_layout(template, status) end end @@ -919,6 +920,10 @@ module ActionController #:nodoc: @template.file_public?(template_name) end + def template_exempt_from_layout?(template_name = default_template_name) + @template.javascript_template_exists?(template_name) + end + def assert_existance_of_template_file(template_name) unless template_exists?(template_name) || ignore_missing_templates full_template_path = @template.send(:full_template_path, template_name, 'rhtml') diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index 815a55739f..caf29ea113 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -229,11 +229,13 @@ module ActionController #:nodoc: private def apply_layout?(template_with_options, options) - if template_with_options - (options.has_key?(:layout) && options[:layout]!=false) || options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? - else - true - end + template_with_options ? candidate_for_layout?(options) : !template_exempt_from_layout? + end + + def candidate_for_layout?(options) + (options.has_key?(:layout) && options[:layout] != false) || + options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? && + !template_exempt_from_layout?(default_template_name(options[:action])) end def pick_layout(template_with_options, options, deprecated_layout) |