rails_cursor_pagination icon indicating copy to clipboard operation
rails_cursor_pagination copied to clipboard

PG::AmbiguousColumn: ERROR: column reference is ambiguous

Open AmitLamichhane2021 opened this issue 2 years ago • 4 comments
trafficstars

Hi Team, I am trying to use custom ordering via the order_by property and I am running into a "column reference is ambiguous" error. The column I am trying to order by is called created_at. My pagination query joins to multiple tables that all have a created_at column, so that column name is ambiguous if used by itself. I get the following error when trying to paginate with a cursor: block in tagged - PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous It seems like the gem isn't appending the table name to custom order_by columns, is this the case?

AmitLamichhane2021 avatar Jan 09 '23 00:01 AmitLamichhane2021

it looks like a fork has a fix for this: https://github.com/frollous/rails_cursor_pagination/commit/efc9a1551ac6e0b64d6a5c01193202b9fc4dcb65#diff-c201f4d60dd83e98535d880e8d9b9ad479792383bb84e0cddd4a9122514e11b5

i'm testing it now in our application. i tried making a pr with this change + specs but i cannot get the specs running locally on my machine (the combination of ruby 3.0.6 + mysql2 won't build on my mac?)

modosc avatar Oct 27 '23 17:10 modosc