Browse files

fix some accidental nils

  • Loading branch information...
1 parent 3726080 commit 03e9a6417d52e2783a8a82e733f6e9ef000ece52 @tenderlove tenderlove committed Jun 22, 2012
View
2 actionpack/lib/action_view/lookup_context.rb
@@ -24,7 +24,7 @@ def self.register_detail(name, options = {}, &block)
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)
View
4 actionpack/lib/action_view/renderer/template_renderer.rb
@@ -18,10 +18,10 @@ def render(context, options)
# 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)

0 comments on commit 03e9a64

Please sign in to comment.