rails / jbuilder

Jbuilder: generate JSON objects with a Builder-style DSL
MIT License
4.34k stars 440 forks source link

Passing a block to a partial #429

Open samstarling opened 6 years ago

samstarling commented 6 years ago

Hello! Is there any way to pass a block to a partial? For example like this

json.partial!('member', member: @member) do
  json.total_loans(@member.total_loans)
end

In the partial, it looks like this:

json.id member.id
json.type member.class
json.attributes do
  json.name member.name
  json.date_of_birth member.date_of_birth
  yield
end

But it doesn't work. Any ideas?

scriptfans commented 6 years ago

+1 for this

tien7668 commented 5 years ago

+1

scriptfans commented 3 years ago

Is there any news for this feature?