# User.find\_by(id: 123) fails: no login, no adminstration

**URL:** <https://meta.discourse.org/t/user-find-by-id-123-fails-no-login-no-adminstration/117176>\
**Category:** Self-hosting\
**Created:** [08.Май.2019 14:01:32 UTC](https://meta.discourse.org/t/user-find-by-id-123-fails-no-login-no-adminstration/117176 "2019-05-08T14:01:32Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Blizzz](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Blizzz](https://meta.discourse.org/u/Blizzz)\
**Post date:** [08.Май.2019 14:01:32 UTC](https://meta.discourse.org/t/user-find-by-id-123-fails-no-login-no-adminstration/117176/1 "2019-05-08T14:01:32Z")

</div>

We have some users where the profile page is visible, but neither login works for them nor can I administer them. It always results in a 404 page.

I went to the rails console and tried to look up the user by id and username:

```plaintext
[2] pry(main)> User.find_by(id: 2)
=> nil
[3] pry(main)> User.find_by(username_lower: "juanettedoe")
=> #<User:0x00005622930e5770
 id: 2,
 username: "juanettedoe",
 …

```

So, looking up via username works and it reveals the correct user id. But, looking up by user id does not result in the dataset. What can I do about it?

---

_[View the full topic](https://meta.discourse.org/t/user-find-by-id-123-fails-no-login-no-adminstration/117176)._
