Skip to content

Pass in variable into presenter #45

Description

@vinnyglennon

Url: /api/v1/videos?auth_token=11112323432432

In controllors/api/v1/videos
I can easily get the user from the auth_token. I want to then make it available in the presenter, ideally via render :json => present("videos") { videos, :extra => user }

Is it possible to pass variables to presenter?
render :json => present("videos") { Widget.visible_to(current_user) } does not work in this case, as in the presenter, I want to show different information, depending on the user

I am currently storing the user_id in a thread in a controller:
Thread.current[:user_id] = 1

and accessing that in the presenter, but this is far less than ideal.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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