This project is archived and is in readonly mode.
New update_attribute doesn't work with associations
-
Neeraj Singh
- State changed from new to resolved
- Importance changed from to Low
My bad. I should have updated the doc after the refactoring.
Doc has been updated http://github.com/lifo/docrails/commit/767de13ff4a19a53d3fe99edb555...
Thanks for the feedback.
-
Mateusz Drożdżyński
What was the reason for not supporting associations? Is this a design decision or simply something that is yet to be added?
-
Mateusz Drożdżyński
Plus, regardless of the rationale behind it, shouldn't it raise an exception when you're trying to do so as opposed to going all the way through with the database query?
-
Neeraj Singh
update_attribute was meant for sure shot way of updating a column. For example after sending an email to a user you want to mark that email has been sent to user. You don't want any validation or before_save callback to abort the operation. In one case employer sent 3300 emails to same person because before_save operation returned false.
In 2-3 people used update_attribute to update association because update_attribute was using save and that operation was allowed. However that was not how update_attribute was supposed to be used. In rails3 scope of update_attribute has been limited.
Regarding raising the exception I did not think it was that big a deal because it will be caught during development time. I might be wrong on that.