ensure that child usage does not manipulate cached template
This commit is contained in:
parent
297f8a9145
commit
cb53352607
@ -67,7 +67,7 @@ module RablRails
|
||||
name = options[:root] if options.has_key? :root
|
||||
if options[:partial]
|
||||
template = Library.instance.compile_template_from_path(options[:partial])
|
||||
@template[name] = template.merge!(:_data => data)
|
||||
@template[name] = template.merge(:_data => data)
|
||||
elsif block_given?
|
||||
@template[name] = sub_compile(data) { yield }
|
||||
end
|
||||
|
@ -2,7 +2,7 @@ module RablRails
|
||||
class CompiledTemplate
|
||||
attr_accessor :source, :data, :root_name
|
||||
|
||||
delegate :[], :[]=, :merge!, :to => :source
|
||||
delegate :[], :[]=, :merge!, :merge, :to => :source
|
||||
|
||||
def initialize
|
||||
@source = {}
|
||||
|
@ -113,6 +113,7 @@ class CompilerTest < ActiveSupport::TestCase
|
||||
|
||||
t = @compiler.compile_source(%{child(:user, :partial => 'users/base') })
|
||||
assert_equal( {:user => { :_data => :user, :id => :id } }, t.source)
|
||||
assert_equal( {:id => :id}, mock_template.source)
|
||||
end
|
||||
|
||||
test "glue is compiled as a child but with anonymous name" do
|
||||
|
Loading…
Reference in New Issue
Block a user