> Why so silly query is generated? It should be:
> SELECT * FROM demos ORDER BY MyDifferentId
This query only gets created and executed when you do a find that
contains a :limit and :offset option (usually done for you by the
pagination helper). The reason for the multiple sub-queries is to
compensate for SQL Server''s lack of native LIMIT/OFFSET support.
Seeing your query, I realize that it might be best to build in some
additional logic into the adapter to keep from doing the nested sub-
queries in the case where the LIMIT + OFFSET >= the row count of the
table. I''ll make sure to get that adjusted for the next Rails release.
> ActiveRecors models cannot redefine names of primary keys for
> sqlserver adapter.
Currently there is no way for the adapter to know what the defined
primary_key is since this happens in the Model and isn''t passed in to
the adapter when a find is executed. You can bypass this current
deficiency by specifying a :order option to your find method(s).
I''m trying to figure out an elegant way to support this issue, but as
of right now, haven''t come up with a solution.I hope to have
something before the next release, but if you have any suggestions,
I''d love to hear them.
--
DeLynn Berry
delynn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org