Deleted record can't be restored #22

Closed
rdavila opened this Issue Feb 24, 2011 · 1 comment

Comments

Projects
None yet
1 participant

rdavila commented Feb 24, 2011

Hi, I'm trying to restore a record following the documentation:
Property::Archive.last.destroy
But it isn't restored, so I'm checking the source of the plugin and debugging and I can see this:

(rdb:1) p merge_options
{}
(rdb:1) p where
"`id` = 28786"
(rdb:1) p config[:to]
Property::Archive(...)
...
(rdb:1) p config[:from]
 Property(...)

So I don't know why it is moving the record to the archive table instead of the other table.

rdavila commented Feb 28, 2011

I've solved this problem, it was related to Single Table Inheritance. When Property::Archive was returning the record it was automatically converted to the type dictated by the 'type' column, so my workaround was create an initializer and change the inheritance column for the archive class:

class Property::Archive
  set_inheritance_column 'does_not_have_one'
end

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment