This project is archived and is in readonly mode.

#2193 ✓resolved
Manfred Stienstra

with_scope merges create conditions incorrectly

Reported by Manfred Stienstra | March 10th, 2009 @ 11:32 AM | in 2.x

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.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

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket


Referenced by