Radio Active
Radio Active

Reputation: 497

elixir guardian get current user in model

I can't get current logged in user in my model. There are many things which I wanna do with that. e.g when a user creates a blog post, I want to associate with that user. User has many blog posts. There are many scenarios in which I need current user. One solution I can think of is to add a virtual field to all of my schemas after authentication assign current user to that virtual field. But I dont wanna repeat to add that virtual field to all of my models.

Note: this question has been asked before and someone tried to send a conn object to model which is discourged. Thanks in advance

Upvotes: 0

Views: 2139

Answers (0)

Related Questions