This project is archived and is in readonly mode.
except(:order).order(...) is not working in scopes
-
Vitalii Khustochka
Typo in the description: "Instead there is a test named test_named_scope_overwrites_default but I think this name is incorrect ..."
test_named_scope_appends_default is the new name I gave it in the patch
-
Vitalii Khustochka
Looks like this happens because reorder_flag was removed. Named scope defined with except(:order).order(xxx) now has no difference with the one defined with order(xxx). So when merging order_value they are merged like they were defined by regular order i.e. are being appended to default_scope's order instead of overwriting them.
When a chain of methods is run on the relation except works correctly because it effectively removes the current order_value of this very relation, but in the scope it does not.
-
Santiago Pastorino
- Milestone set to 3.1
- Importance changed from to Low
-
2kan
It's not because reorder_flag was removed but yes it is because of how except and merge are working now. I gonna attach a patch (against edge) tomorrow, I want to find the best way to fix it.
-
rails
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails
- State changed from open to stale
-
Santiago Pastorino
2kan have you tried it with the latest master code?. Is still an issue?
-
2kan
Santiago, yes it is. (Just checked). Somehow (not sure) it is because of: https://rails.lighthouseapp.com/projects/8994/tickets/6290-patch-ex...
And because of how the default_scope applies (I think I've figured out why I doesn't work).
