This project is archived and is in readonly mode.
update_attribute from STI model does not work
-
Ariejan de Vroom
- Tag changed from bug, sti, update_attribute to 2.2, bug, rails-2.2, sti, update_attribute
More info:
I'm using the latest Rails 2.2 gem with a MySQL database.
-
Frederick Cheung
Just for the record, this is nothing to do with STI.
This happens if - You load a model - You change the association (build, create, or =) - You then change the foreign key
As you may have already noticed, if foo belongs_to bar changing :bar_id will not cause the value of foo.bar to change if the association is already loaded and this is slightly connected. During the save activerecord thinks that the current value of the association is foo.bar and so overwrites the change you made to the foreign key
-
Pratik
- State changed from new to stale