Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord methods with ap displays nothing #428

Open
ogirginc opened this issue Mar 21, 2024 · 0 comments
Open

ActiveRecord methods with ap displays nothing #428

ogirginc opened this issue Mar 21, 2024 · 0 comments

Comments

@ogirginc
Copy link

ogirginc commented Mar 21, 2024

Update

Most probably related to IRB. If you have a similar issue, check this issue too: rails/rails#47413

For a quick fix, add the irb gem to Gemfile.


When I do a simple user search without prefixing ap, nothing is displayed. I can only see the result if I use ap. Any idea why this might be happening?

An actual example from Rails development env:

irb(main):001:0> User.where(email: "[email protected]")
  User Load (34.8ms)  SELECT "users".* FROM "users" WHERE "users"."email" = $1  [["email", "[email protected]"]]
  Company Load (1.0ms)  SELECT "companies".* FROM "companies" WHERE "companies"."id" = $1 LIMIT $2  [["id", "21b82085-ac24-49a1-a0f6-77dc74a2c10c"], ["LIMIT", 1]]
(Object doesn't support #inspect)
=>
irb(main):002:0> ap User.where(email: "[email protected]")
  User Load (34.1ms)  SELECT "users".* FROM "users" WHERE "users"."email" = $1  [["email", "[email protected]"]]
[
    [0] #<User:0x000000012303d2b0> {
                            "email" => "ogulcan@example.com",
                       "created_at" => Thu, 22 Dec 2022 12:03:14.967544000 +03 +03:00,
                       "updated_at" => Fri, 15 Mar 2024 10:47:38.705889000 +03 +03:00,
                               "id" => "c634175a-3d1d-4302-b5de-f550becb1e8e",
                       "company_id" => "21b82085-ac24-49a1-a0f6-77dc74a2c10c"
    }
]
=> nil

Ruby Version ––> 3.2.3 (2024-01-18 revision 52bb2ac0a6) [arm64-darwin23]
Rails Version ––> 6.1.7.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant