Skip to content

Commit 559eb29

Browse files
committed
Merge pull request #296 from nambrot/patch-1
Add `ignore_nil! to documentation`
2 parents 86fb406 + bfcfac6 commit 559eb29

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ json.author do
196196
end
197197
```
198198

199+
To prevent Jbuilder from including null values in the output, you can use the `ignore_nil!` method:
200+
201+
```ruby
202+
json.ignore_nil!
203+
json.foo nil
204+
json.bar "bar"
205+
# => { "bar": "bar" }
206+
```
207+
199208
Fragment caching is supported, it uses `Rails.cache` and works like caching in
200209
HTML templates:
201210

0 commit comments

Comments
 (0)