Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty array rendered as null instead of [] #8

Open
niksosf opened this issue Nov 14, 2016 · 1 comment
Open

empty array rendered as null instead of [] #8

niksosf opened this issue Nov 14, 2016 · 1 comment

Comments

@niksosf
Copy link

niksosf commented Nov 14, 2016

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
Copy link

Possibly related #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants