New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update_all ignores conditions, when :orders and :limit options are supplied #765
Comments
Imported from Lighthouse. looking into it. |
Imported from Lighthouse. Attached is a failing test. Relation is being built right. Look like issue is with Arel. Studying the code. Patch might take a while :-) |
Imported from Lighthouse. 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. |
Imported from Lighthouse. [state:open] this problem persists for 3.0.5. Ruby 1.9.2 |
Imported from Lighthouse. Looks like the bug is in ARel indeed. When a subquery is generated, all other WHERE clauses are dropped. I attached a patch that fixes this bug and adds a test case. |
Imported from Lighthouse. The previous patch kept the where conditions on the UPDATE statement. That is not the correct behavior, as the order/limit clauses wouldn't be applied with the WHERE clauses in mind. This one passes the WHERE clauses to the generated subquery. |
Imported from Lighthouse. @hugo I've applied this patch to ARel master which is the unreleased 2.1.0 version. Would you mind backporting this to 2.0.x? |
Imported from Lighthouse. 2.0.x backported patch attached. |
Attachments saved to Gist: http://gist.github.com/971734 |
…ather than default primary key [rails#765] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6058
Created by Valentine Bichkovsky - 2010-11-24 18:03:39 UTC
Rails version: 3.0.2 and 3.0.3 (no such bug in Rails 3.0.1)
Ruby 1.8.7
Adapter: postgres
In code:
In log file:
h3. After removing :order and :limit options
In code:
In log file:
The text was updated successfully, but these errors were encountered: