diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-06-22 16:21:58 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-06-22 16:22:09 -0700 |
commit | 03e9a6417d52e2783a8a82e733f6e9ef000ece52 (patch) | |
tree | e4d1a8c0eb17f0a75e226b4d784d0bcd7d54b47d /actionpack/lib | |
parent | 3726080ecea8b34edeac37f358e8dd050cbb00cb (diff) | |
download | rails-03e9a6417d52e2783a8a82e733f6e9ef000ece52.tar.gz rails-03e9a6417d52e2783a8a82e733f6e9ef000ece52.tar.bz2 rails-03e9a6417d52e2783a8a82e733f6e9ef000ece52.zip |
fix some accidental nils
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/lookup_context.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/renderer/template_renderer.rb | 4 |
2 files changed, 3 insertions, 3 deletions
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) |