Skip to content

Cache key depending on multiple dependencies #519

@robinvdvleuten

Description

@robinvdvleuten

As the documentation only shows examples using cached: true as option when rendering collections, I was wondering if it is possible to use a lambda to define multiple dependencies in a similar way as the render method;

<%= render partial: 'projects/project', collection: @projects, cached: -> project { [ project, current_user ] } %>

So could I use something similar with jbuilder?

json.projects current_user.projects, partial: 'projects/project', as: :project, cached: -> project { [ project, current_user ] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions