lib/action_view/base.rb in actionpack-1.7.0 vs lib/action_view/base.rb in actionpack-1.8.0
- old
+ new
@@ -117,11 +117,11 @@
#
# More builder documentation can be found at http://builder.rubyforge.org.
class Base
include ERB::Util
- attr_reader :first_render
+ attr_reader :first_render
attr_accessor :base_path, :assigns, :template_extension
attr_accessor :controller
# Turn on to cache the reading of templates from the file system. Doing so means that you have to restart the server
# when changing templates, but that rendering will be faster.
@@ -155,11 +155,11 @@
def self.register_template_handler(extension, klass)
@@template_handlers[extension] = klass
end
def initialize(base_path = nil, assigns_for_first_render = {}, controller = nil)#:nodoc:
- @base_path, @assigns = base_path, assigns_for_first_render
+ @base_path, @assigns = base_path, assigns_for_first_render.with_indifferent_access
@controller = controller
end
# Renders the template present at <tt>template_path</tt>. If <tt>use_full_path</tt> is set to true,
# it's relative to the template_root, otherwise it's absolute. The hash in <tt>local_assigns</tt>
@@ -262,9 +262,10 @@
end
def evaluate_locals(local_assigns = {})
b = binding
+ local_assigns.stringify_keys!
local_assigns.each { |key, value| eval "#{key} = local_assigns[\"#{key}\"]", b }
@assigns.each { |key, value| instance_variable_set "@#{key}", value }
xml = Builder::XmlMarkup.new(:indent => 2)
b
\ No newline at end of file