amatsuda / jb

A simple and fast JSON API template engine for Ruby on Rails
MIT License
1.29k stars 43 forks source link

Partials render weirdly #24

Open newstler opened 5 years ago

newstler commented 5 years ago

Hi, I have a common situation: index and show actions both should render an object partial. When I place the code into the corresponding views (index.json.jb and show.json.jb) everything is good, but when I place there any modifications of render partial: 'object', collection: @objects, it renders weird output:

"<!-- begin: app/views/api/v1/objects/_object.json.jb (from app/views/api/v1/objects/index.json.jb:1) -->\n[{:id=>1, :name=>\"Name 1\", :position=>0, :description=>\"Test 1\"}, {:id=>2, :name=>\"Name 2\", :position=>1, :description=>\"Test 2\"}]<!-- end: app/views/api/v1/objects/_object.json.jb (from app/views/api/v1/objects/index.json.jb:1) -->"

Is it me doing something wrong or is it a bug? Thank you.

Btw, I'm on Ruby 2.3.4 Rails 4.1.1