Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

with_scope merges create conditions incorrectly

#2193

To make chained named scopes work, with_scope was changed to do a reverse merge of create conditions. This breaks normal use of with_scope for create conditions. For example:


comment = nil
Comment.with_scope(:create => {:conditions => {:approved => true}}) do
  Comment.with_scope(:create => {:conditions => {:approved => false}}) do
    comment = Comment.new
  end
end
comment.approved? #=> true

My solution is to add a new action to with_scope: the reverse_merge. If you want, you can pull the change from http://github.com/Manfred/rails/...

Reported by Manfred Stienstra · March 10th, 2009 @ 11:32 AM

State: resolved
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none