Chaining named scopes with paginate doesn't work with MS SQL Server
-
Mislav
In the latest application I'm developing, we're really putting named scopes to the max and so far I haven't seen a single MySQL query generated incorrectly.
So, my guess is this is an issue with the adapter or maybe in your code.
There are a number of oddities with the SQL and code you pasted:
- there is mention of "T_PAExtensions2009" table, but the table name is "TReport";
- you pasted
Report.for_pharmacy(session[:userid])but I'm sure you meantfor_user; - there is the
ncpdp = '3303461'condition which is not generated by any of the scopes in your pastie.
It seems to me that the "failing SQL query" above wasn't generated by any of the code presented in the pastie.
-
Jon Canady
Heh. Strictly speaking the boss is wary of production table /column names leaking out, and it looks like my attempt to sanitize our data didn't work so well. Sorry about that, it turns a mostly useful bug report into a confusing mess. The two tables are in fact the same table. The two named scopes (.for_pharmacy, .for_user) reference the same named scope, and ncpdp is also user_id.
But I doubt that will clear things up any more, so I'll look at the adapter and see what I can find.
-
John Tjanaka
- Milestone order changed from 0 to 0
I know this is a bit late, but I got the same exact issue, using Rails 2.2.22 and activerecord-sqlserver-adapter (1.0.0). However when I upgrade the adapter to 2.2.22, and use will_paginate 2.3.11, the problem is gone.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.