paginate_by_sql fails when using different databases #117

fabiob opened this Issue Mar 22, 2011 · 0 comments


None yet
1 participant

fabiob commented Mar 22, 2011

My rails application, on my development environment, runs on SQLite, but access some legacy Oracle database (using ActiveRecord::Base.establish_connection on the legacy models).

Since it's a legacy database, used mostly for querying, I use find_by_sql a lot. I started working with will_paginate on some queries, switched my calls to find_by_sql for paginate_by_sql, but Oracle started complaining about SQL syntax errors.

Digging through the logs, I noticed that will_paginate added 'LIMIT 20 OFFSET 20' to my query - the SQLite way of pagination. Looks like it's trying to use the adapter configured for ActiveRecord::Base, and not for my additional model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment