Skip to content

Using Draper with Rabl #286

@cmer

Description

@cmer

I have the following templates:

# autocomplete_suggestions
collection @users
extends "memberships/autocomplete_suggestion"

and

# autocomplete_suggestion
object UserDecorator.decorate(@user)
attributes :id

node(:name)     { |u| u.full_name }
node(:avatar)   { |u| u.avatar_url }
node(:type)     { |u| u.class.to_s }
node(:location) { |u| u.location || '' }

avatar_url is defined in my Draper decorator, but I cannot access it from inside the node. Is there a way to wrap my @user object in a decorator from inside Rabl?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions