[Rails] delete_if doesn't work for has_and_belongs_to_many

John Anderson ardour at semiosix.com
Wed Aug 9 22:07:17 GMT 2006


On Tue, 2006-08-08 at 22:37 -0400, dblack at wobblini.net wrote:
> >> From my point of view, another way of seeing it is this: why is there a
> > method that does something very unexpected (ie not manipulate records in
> > the db when that's the express purpose of the collection in question),
> > when it doesn't even need to exist since there are other ways to achieve
> > the same functionality?
> 
> It's interesting that push is magic, but pop isn't :-)  And same with
> delete and delete_if.  Also, while you can't do:
> 
>    ar_collection << 100
> 
> you *can* do:
> 
>    ar_collection[1] = 100
> 
> I guess it's a tradeoff between the vanilla array behavior and the
> special AR behavior

Now that is *exactly* what I can't get my head around on this issue -
why is it desirable that there should be a tradeoff?

bye
John




More information about the Rails mailing list