https://avo.cool logo
Hey all, i'm using avo (2.51.0), and after I m...
# avo-2
v
Hey all, i'm using avo (2.51.0), and after I migrated from avo 2.40 all my index pages have order by created_at ASC, but I need to change for DSC globally for all index pages. Reading the docs, I can't find anything that helped me, anyone have some ideias? On avo 2.40
Copy code
Started GET "/admin/resources/users" for ::1 at 2024-05-22 18:13:53 -0300
  User Load (1.7ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", "38b63179-b9a4-4a2d-8c49-4eb0b84c78f6"], ["LIMIT", 1]]
Processing by Avo::UsersController#index as HTML
  User Count (0.8ms)  SELECT COUNT(*) FROM "users"
  User Load (1.3ms)  SELECT "users".* FROM "users" ORDER BY users.created_at desc LIMIT $1 OFFSET $2  [["LIMIT", 72], ["OFFSET", 0]]
On Avo 2.51
Copy code
Started GET "/admin/resources/users" for ::1 at 2024-05-22 18:14:53 -0300
  ActiveRecord::SchemaMigration Pluck (1.6ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
  User Load (3.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."created_at" ASC, "users"."id" ASC LIMIT $2  [["id", "38b63179-b9a4-4a2d-8c49-4eb0b84c78f6"], ["LIMIT", 1]]
Processing by Avo::UsersController#index as HTML
[Avo] Performing request to avohq.io API to check license availability.
Started GET "/admin/resources/users" for ::1 at 2024-05-22 18:14:53 -0300
  User Load (1.1ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."created_at" ASC, "users"."id" ASC LIMIT $2
m
Thread automatically created by thiagão in #740893011994738751
l
TBH, I don't think anything changed on our side between those two versions
I don't think we ever ordered the records by the id. we "always" used the
created_at
attribute
I would suggest upgrading to v3 also. you could use the
index_query
option to unscope the initial order and add your own
v
@lemon-wall-20836 thanks!