This project is archived and is in readonly mode.
Support of OR as condition connector in merge_conditions
-
Kane
interessing.. but i dont like the syntax :connector => "OR" cant it be a symbol?
and just defaulting to and if its nor and or or feels strange, the developer should be noticed about his error otherwise he wonders why he didnt get back what he expected. -
Lennart Koopmann
I made the :connector parameter optional because currently AND is the standard connector. I don't know what the usual way for Rails is but my experience says that it's better to keep the default behaviour and add the new function as an not required option.
I'll create a new patch that makes the :connector a symbol.
-
Kane
# Only allow AND or OR as connector. Default to AND. connector = "AND" unless connector == "AND" or connector == "OR"i meant this line of code, if i put some other thing into it, say:
Product.merge_conditions :conditions => conditions, :connector => :xor
i end up with the connector "and", but i specified "xor".
you are absolutely right it doesnt makes any sense to require the connector option and it should indeed default to 'and', but if i explicitly specify it, it should not simply be set to 'and' cause its not 'and' or 'or'.
There is more then 'and' and 'or' and i would suggest just setting it to 'and' if no connector is set else just use the passed operator.
-
Lennart Koopmann
Ah, okay. That's true. I'll also change that in the next patch. :)
-
Lennart Koopmann
Here we go. The new patch.
-
Lennart Koopmann
Previous patch deleted. Here is the new one (Changed email address)
-
Josh Sharpe
-1 applies cleanly to master
breaks existing tests
no new tests -
Lennart Koopmann
All the tests run fine for me. Which fail on your system?
-
CancelProfileIsBroken
- Tag changed from patch to bugmash, patch
-
Rizwan Reza
- Tag changed from bugmash, patch to activerecord, feature, patch
- State changed from new to open
The patch applies with some whitespace errors. Please provide tests also. Thanks!
-
Kane
this is no longer relevant since arel or is it?
I think it can be closed. -
Jeff Kreeftmeijer
- Title changed from [PATCH] Support of OR as condition connector in merge_conditions to Support of OR as condition connector in merge_conditions
- Tag set to activerecord, patch
Using the "patch" tag instead of prefixing the ticket title with "[PATCH]" to make sure patched tickets end up in the open patches bin. :)
-
Santiago Pastorino
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.
-
Santiago Pastorino
- State changed from open to stale
