aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/abstract_controller/layouts.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb2
-rw-r--r--actionpack/lib/action_view/template.rb4
-rw-r--r--actionpack/test/template/render_test.rb3
-rw-r--r--activesupport/lib/active_support/cache.rb6
5 files changed, 8 insertions, 9 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb
index 6a6387632c..aa39e21ba9 100644
--- a/actionpack/lib/abstract_controller/layouts.rb
+++ b/actionpack/lib/abstract_controller/layouts.rb
@@ -322,7 +322,7 @@ module AbstractController
super
if _include_layout?(options)
- layout = options.key?(:layout) ? options.delete(:layout) : :default
+ layout = options.delete(:layout) { :default }
options[:layout] = _layout_for_option(layout)
end
end
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 53fd189c39..2cf1c9055c 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -313,7 +313,7 @@ module ActionView
options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
end
- escape = options.key?("escape") ? options.delete("escape") : true
+ escape = options.delete("escape") { true }
content = ERB::Util.html_escape(content) if escape
content_tag :textarea, content.to_s.html_safe, { "name" => name, "id" => sanitize_to_id(name) }.update(options)
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 644debd49c..630625fb90 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -163,10 +163,12 @@ module ActionView
pieces = @virtual_path.split("/")
name = pieces.pop
partial = !!name.sub!(/^_/, "")
- lookup.formats = @formats
+ previous_formats, lookup.formats = lookup.formats, @formats
lookup.disable_cache do
lookup.find_template(name, [ pieces.join('/') ], partial, @locals)
end
+ ensure
+ lookup.formats = previous_formats
end
def inspect
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index e4ce756bf8..3b461f3529 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -52,10 +52,11 @@ module RenderTestCases
end
def test_render_template_with_a_missing_partial_of_another_format
+ @view.lookup_context.freeze_formats([:html])
assert_raise ActionView::Template::Error, "Missing partial /missing with {:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder]}" do
- @view.lookup_context.freeze_formats([:html])
@view.render(:template => "with_format", :formats => [:json])
end
+ assert_equal [:html], @view.lookup_context.formats
end
def test_render_file_with_locale
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index 26e737e917..d7408eff9f 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -382,11 +382,7 @@ module ActiveSupport
options = merged_options(options)
instrument(:exist?, name) do |payload|
entry = read_entry(namespaced_key(name, options), options)
- if entry && !entry.expired?
- true
- else
- false
- end
+ entry && !entry.expired?
end
end