This project is archived and is in readonly mode.
[PATCH] Default scopes can't be merged with something that responds_to call
-
2kan
- Tag changed from rails edge, active_record, default_scope to rails edge, active_record, bug, default_scope, patch
Here is my patch (with test) that raises exception in such situations.
-
Adam Wróbel
There is an open ticket to enable proc handling for default scope. It contains a patch that enables lambda default scopes instead of raising an exception on receiving one.
https://rails.lighthouseapp.com/projects/8994/tickets/1812-default_...
-
2kan
@Adam, Looks like are familiar with those ticket and patches. What are the current status? Are they working for edge rails? I mean that as I see you can define default_scope with lambda now and it works correct. But what about merging two default_scopes where one uses lambda and one hash or AR::Relation? Does it work correct and lambda evaluates when we apply default_scopes but not when we are define them?
-
Adam Wróbel
It's currently waiting to be reviewed by Aaron and hopefully merged into edge for a release in 3.1. And yes - that code allows one to call default_scope multiple times and merges finders and lambdas calling the latter at the time of database fetch rather than default_scope definition.
-
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
