ccocchi / rabl-rails

Rails 4.2+ templating system with JSON, XML and Plist support.
MIT License
209 stars 51 forks source link

Child with partial failed to render #5

Closed shmeltex closed 11 years ago

shmeltex commented 11 years ago

If following syntax is used in template

child(:@notes => :data, :partial => 'notes/_single')

Child element will produce no output.

Workaround is

child({:@notes => :data}, :partial => 'notes/_single')
ccocchi commented 11 years ago

Yes it is a normal issue. child method expects two arguments but with your first example, Ruby parser only sees one hash so it will produce no output.

You can use { ... } to clearly separate the two hashes or you can change this to a clearer syntax :

child(:@notes, :root => :data, :partial => 'notes/_single')

I'll check is there is a clean way to accept your first example as a valid syntax

ccocchi commented 11 years ago

I'll close this issue since it's a normal syntax error. You need to put curly braces to separate the two argument hashes. Thanks for reporting the issue anyway.