I have a model ( say model_a ) that has a relation like:
belongs_to :model_b, :foreign_key => :name
My issue is that when I try to sort by column model_b.name will paginate does the correct sort but will not fire any query to count the total_entries.
In this way the total_entries returned is the size of the page.
I am not sure that the natural key is the culprit but any other relation that I include and sort works fine.
I am on rails 3.1.3 with sql_server.
Possibly an adapter issue?
Most of these issues are Active Record ones since will_paginate doesn't do much besides using its main query methods. Keep in mind that total_entries is a lazy method; it won't fire a query unless it's called.
I'm not sure exactly what your issue is but maybe you could illustrate it to me by calling:
rel = MyModel.some_query.page(1)
Of course I would need the generated SQL too from the log.
My problem is that when sorting for that particular column total_entries does not fire any query. Nothing in the log.
will_paginate will return the rows per page as total_entries.
Will try to give you more details/logs asap.