diff --git a/lib/rabl-rails/compiler.rb b/lib/rabl-rails/compiler.rb index 707a279..8b498ae 100644 --- a/lib/rabl-rails/compiler.rb +++ b/lib/rabl-rails/compiler.rb @@ -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 @@ -161,4 +161,4 @@ module RablRails @template = old_template end end -end \ No newline at end of file +end diff --git a/lib/rabl-rails/library.rb b/lib/rabl-rails/library.rb index a421416..057ec87 100644 --- a/lib/rabl-rails/library.rb +++ b/lib/rabl-rails/library.rb @@ -33,4 +33,4 @@ module RablRails compile_template_from_source(t.source, path) end end -end \ No newline at end of file +end diff --git a/lib/rabl-rails/renderers/base.rb b/lib/rabl-rails/renderers/base.rb index 64b45ee..45b28c9 100644 --- a/lib/rabl-rails/renderers/base.rb +++ b/lib/rabl-rails/renderers/base.rb @@ -129,4 +129,4 @@ module RablRails end end end -end \ No newline at end of file +end diff --git a/lib/rabl-rails/template.rb b/lib/rabl-rails/template.rb index 403b701..62d337c 100644 --- a/lib/rabl-rails/template.rb +++ b/lib/rabl-rails/template.rb @@ -2,10 +2,10 @@ module RablRails class CompiledTemplate attr_accessor :source, :data, :root_name - delegate :[], :[]=, :merge!, :to => :source + delegate :[], :[]=, :merge!, :merge, :to => :source def initialize @source = {} end end -end \ No newline at end of file +end diff --git a/test/compiler_test.rb b/test/compiler_test.rb index 0f80af1..5a9cde5 100644 --- a/test/compiler_test.rb +++ b/test/compiler_test.rb @@ -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 @@ -188,4 +189,4 @@ class CompilerTest < ActiveSupport::TestCase assert_equal [:users, :users], @compiler.send(:extract_data_and_name, :users) assert_equal [:@users, :authors], @compiler.send(:extract_data_and_name, :@users => :authors) end -end \ No newline at end of file +end