I need to create an area in my model Userthat will get all users whose email attribute is included in emails AdminUser.
Basically, there is an attribute emailin the model Userand the same attribute in the model AdminUser. Therefore, I need to get all the users who are actually administrators (via email).
I was unable to implement this as a request for subscription and started by receiving an array of AdminUserletters:
emails = AdminUser.pluck(:email)
and now I'm struggling with getting an admin user array from the model User.
If I write something like this:
User.find_by_email(emails)
I get only one entity, not an array.
So my question is:
, admins, User, ?
: User:
def admin?
AdminUser.find_by(email: email) ? true : false
end
, - ?