Closed nneal closed 11 years ago
@NealKemp The last build was https://travis-ci.org/geokit/geokit-rails/builds/10199966 (rails 3 works in that build but not rails 4, precisely because of this issue)
Thanks for going into the detail to find why rails 4 breaks this function. That'll help it get fixed.
I might have a look at it, but perhaps there's another way to send in our order clause so it doesn't have the double DESC statements, or maybe we could do a pull request on rails to fix this?, e.g.
I assume it doing it for this reason: 'first ASC, second DESC' -> 'first DESC, second ASC' or something like that
Maybe the rails order method needs to take into account brackets, etc. to deal with our more complex case.
I just looked at some of the tests and it looks like we're using a deprecated method all
which may be the root of some of our problems.
If, in the tests, we switch to using to_a
which is recommended, the tests pass. Also, it gets rid of the thousands of warnings I get when running the tests.
Should we make the assumption that people should be using the to_a
and not the deprecated all
or do you think we should make tests pass using all
. I'd lean towards the former since this is a Rails 4 branch
Looks like your PR has fixed this. Excellent work @NealKemp
Been trying to fix some test errors on the Rails4 branch. Just compiling some info here.
also occurs in:
Occuring on Postgres and MySQL
It appears that the problem is introduced when ActiveRecord splits strings with a comma to inject
ASC
/DESC
here: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/relation/query_methods.rb#L994I'm not sure if it's truly an ActiveRecord error or if we are passing in a malformed
order
string.The order passed in is:
@mnoack can I assume that all the tests on Rails4 branch are up to date?