ActiveRecord methods with `ap` displays nothing
ogirginc opened this issue · 0 comments
ogirginc commented
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: "ogulcan@example.com")
User Load (34.8ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 [["email", "ogulcan@example.com"]]
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: "ogulcan@example.com")
User Load (34.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 [["email", "ogulcan@example.com"]]
[
[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