From 03e9a6417d52e2783a8a82e733f6e9ef000ece52 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 22 Jun 2012 16:21:58 -0700 Subject: fix some accidental nils --- actionpack/lib/action_view/lookup_context.rb | 2 +- actionpack/lib/action_view/renderer/template_renderer.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index b7945a23be..00989ec405 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -24,7 +24,7 @@ module ActionView Accessors.send :define_method, :"default_#{name}", &block Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1 def #{name} - @details[:#{name}] + @details.fetch(:#{name}, []) end def #{name}=(value) diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb index 82892593f8..3c1b11396a 100644 --- a/actionpack/lib/action_view/renderer/template_renderer.rb +++ b/actionpack/lib/action_view/renderer/template_renderer.rb @@ -18,10 +18,10 @@ module ActionView # Determine the template to be rendered using the given options. def determine_template(options) #:nodoc: - keys = options[:locals].try(:keys) || [] + keys = options.fetch(:locals, {}).keys if options.key?(:text) - Template::Text.new(options[:text], formats.try(:first)) + Template::Text.new(options[:text], formats.first) elsif options.key?(:file) with_fallbacks { find_template(options[:file], nil, false, keys, @details) } elsif options.key?(:inline) -- cgit v1.2.3