You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and being Booking._SQL_FOR_NEW = ['select * from bookings where booking_statuses_id = ?',Booking._NEW_STATUS.to_i]
The pagination works OK, but the order clause seems to be ignored. Putting the order clause in the native SQL sentence and removing it from the pagination command, everything works OK.
So, long story short: When using find_by_sql and thus, a native sql query, the pagination ":order" clause is futile. To avoid it, one must put the ordering clause in the SQL query.
¿Is it a bug or is it my fault for something I've missed?
PS: Its just a quick question. If it's not a known issue, I will provide all version details. Thanks!
The text was updated successfully, but these errors were encountered:
Trying to paginate an activerecord set of records from a table, using:
@newBookings = Booking.paginate_by_sql Booking._SQL_FOR_NEW, :page => pageNew, :order => 'create_date DESC'
and being Booking._SQL_FOR_NEW = ['select * from bookings where booking_statuses_id = ?',Booking._NEW_STATUS.to_i]
The pagination works OK, but the order clause seems to be ignored. Putting the order clause in the native SQL sentence and removing it from the pagination command, everything works OK.
So, long story short: When using find_by_sql and thus, a native sql query, the pagination ":order" clause is futile. To avoid it, one must put the ordering clause in the SQL query.
¿Is it a bug or is it my fault for something I've missed?
PS: Its just a quick question. If it's not a known issue, I will provide all version details. Thanks!
The text was updated successfully, but these errors were encountered: