假设我有一个User具有 ausername和 a的模型full_name。我想渲染一个用户对象,Active Model Serializer并且只根据它current_user是 nil 还是登录来渲染特定的参数。由于我也在使用pundit,我想知道是否有办法使用pundit.
例如
用户是nil
{id:1, username: 'foo'}
用户是logged in
{id:1, username: 'foo', full_name: 'bar'}