On 11/09/2010 11:00 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
When I edit the storage_assignment of an AntibodyInstance in AS and set
a different storage, the old StorageAssignment still remains in the
database with an item_id of NULL.
Sorry, I was busy in these days. You are editing AntibodyInstance or
StorageAssignment? If you are editing AntibodyInstance, are you using has_one
or has_one through in the form?
Uhm, me too :)
I'm editing an AntibodyInstance, which
has_one :storage_assignment, :as => :item, :conditions => "item_type =
'AntibodyInstance'", :dependent => :delete
(and quite a few more associations).
When editing an AntibodyInstance, a custom subform is used to edit the
associated StorageAssignment.
When I press submit, this happens:
Parameters: {
"commit"=>"Update",
"action"=>"update",
"_method"=>"put",
"authenticity_token"=>"...",
"id"=>"662", /* AntibodyInstance-ID */
"controller"=>"antibody_instances",
"record"=>{
"storage_assignment"=>{
"storage"=>{
"id"=>"90"
},
"slot"=>{
"id"=>"153"
}
},
"antibody"=>{"id"=>"387"},
...more...
}
}
After that:
mysql> select id,item_id,item_type,storage_id,slot_id from
storage_assignments where item_id=662 OR item_id IS NULL;
+-----+---------+------------------+------------+---------+
| id | item_id | item_type | storage_id | slot_id |
+-----+---------+------------------+------------+---------+
| 813 | NULL | AntibodyInstance | 90 | 177 |
| 814 | 662 | AntibodyInstance | 90 | 118 |
+-----+---------+------------------+------------+---------+
So the previous StorageAssignment is still sitting in the db, just with
a NULLified item_id.
How can I fix this and have the StorageAssignment with id 813 deleted
instead of NULLified?
thanks, Sergio!
ben
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.