Say I have a User
model that has a username
and a full_name
. I want to render a user object using Active Model Serializer
and only render specific parameters based on if the current_user
is nil or logged in. Since I'm using pundit
as well, I was wondering if there was a way to do this using pundit
.
e.g.
user is nil
{id:1, username: 'foo'}
user is logged in
{id:1, username: 'foo', full_name: 'bar'}