Jbuilder missing param when they are empty

November 21, 2020

How to have a fallback value when object is nil on an empty array in Jbuilder.

@examples = []

json.example([])
json.example(@examples) do |example|
  json.id example.id
end

Search