On Sep 17, 2008, at 3:10 PM, Dave Rothlisberger wrote:

>
>> Agreed, it seems to follow the principle of least surprise.
>> However, I wonder if that might have to do with the fact that
>> using a has_many writer method is usually not used in combination  
>> with
>> mass assignment....?
>>
>> I guess for me it just doesn't feel right if by default stuff will  
>> get
>> deleted,
>> where one might expect that you are simply updating the attributes.
>> But this may very well just be me being "paranoia" :)
>> Comments?
>
> You're right: "I submitted a form to edit one of my comments on a blog
> post, and all the other comments got deleted" is way more surprising
> than "when Post#comments= takes a params hash it acts differently than
> when it takes an array of Comment objects."

This is why I don't like overloading the comments= setter to handle  
hashes, but prefer having a comments_params= setter instead.  The  
basic setter deals with models, the params setter is the convenience  
interface for controllers to use for multi-model form support.  It's a  
much simpler implementation too.


--
Josh Susser
http://blog.hasmanythrough.com



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