Browse files

Refactored two methods to use delete with a block

  • Loading branch information...
1 parent 92a7296 commit c0ec40c83a7e2370f0f4a01055aafb69026d8099 @rubenfonseca rubenfonseca committed Feb 21, 2012
View
2 actionpack/lib/abstract_controller/layouts.rb
@@ -322,7 +322,7 @@ def _normalize_options(options)
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
View
2 actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -313,7 +313,7 @@ def text_area_tag(name, content = nil, options = {})
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)

0 comments on commit c0ec40c

Please sign in to comment.