Skip to content

Passing a block to a partial #429

@samstarling

Description

@samstarling

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions