this line:
the_user = self.where(user: user, password:password)
should be:
the_user = self.where(user: user, password:password).first
without the the .first
what you get is a relation object, which can be used to chain further .where
clauses to it (or similar methods). You must use .first
or something like each
on it to actually get records from the database.