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
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.rbrender @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?