amatsuda / jb

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

empty array rendered as null instead of [] #8

Open niksosf opened 8 years ago

niksosf commented 8 years ago

Say I have in projects_controller#index action @projects = [] and I have views/projects/_project.json.rb { name: project.name } and views/projects/index.json.rb render @projects

whenever @projects = [], I get null as the output json. If, however, I modified index.json.jb to

render partial: 'projects/project', collection: @projects, as: :project

it will output [] is this by design?

frederikspang commented 7 years ago

Possibly related https://github.com/amatsuda/jb/issues/11