Hey,

I've submitted some patches to ARel that (supposedly) fix the following bugs:

https://rails.lighthouseapp.com/projects/8994/tickets/6058-update_all-ignores-conditions-when-orders-and-limit-options-are-supplied#ticket-6058-7
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6459-arel-update-method-silently-drops-offset-clause#ticket-6459-2

Before applying these patches, ARel has the following behaviour:

ruby > News.where("highlighted = ?",
true).order("highlighted_at").limit(1).offset(1).update_all(:highlighted
=> false)
UPDATE "news" SET "highlighted" = 'f' WHERE "news"."id" IN (SELECT
"news"."id" FROM "news" ORDER BY highlighted_at LIMIT 1)

Note how both the where("highlighted = ?", true) and offset(1) clauses
are ignored. After the patches, it yields the following:
UPDATE "news" SET "highlighted" = 'f' WHERE (highlighted = 't') AND
"news"."id" IN (SELECT "news"."id" FROM "news" ORDER BY highlighted_at
LIMIT 1 OFFSET 1)

Feedback on these would be appreciated.

Hugo Peixoto
--

website: http://hugopeixoto.net

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to