Is there a way to use devise functions within a model? Let's say, a scope?
For reference, this is what I was thinking of:
scope :available, -> {
if user_signed_in?
requestable
else
requestable.where.not(books: {owner_id: current_user.id})
end
}
I would need to use user_signed_in?
and current_user
in this scope. But I can't. Is there a way to do it?