I’ve got a problem in that users are deleting a paranoid model through
the application, including dependents. Some of these dependents are
paranoid too, but not the attachments. (I’m using DB file storage.) I
need to be able to un-delete these things and I’m now wondering if
acts_as_paranoid will work with models that use attachment_fu? If so, in
what model to I add the acts_as_paranoid bit, and do I need to override
the acts_as_attachment model destroy methods?
class Project < ActiveRecord::Base
has_many :supporting_documents, :as => :documentable, :dependent =>
:destroy
has_many :jobs, :dependent => :destroy
has_many :comments, :as => :resource, :order => ‘created_at desc’,
:dependent => :destroy
has_many :documents
acts_as_paranoid
end
class Job < ActiveRecord::Base
belongs_to :project
acts_as_paranoid
end
class Comment < ActiveRecord::Base
acts_as_paranoid
belongs_to :resource, :polymorphic => true
end
class Document < ActiveRecord::Base
we need to upload efax documents, they have no mime type, so we have
to allow application/octet-stream
has_attachment :content_type => [:image, ‘application/pdf’,
‘application/msword’, ‘text/plain’, ‘application/vnd.ms-excel’,
‘application/msexcel’, ‘application/octet-stream’],
:max_size => 5.megabytes
belongs_to :documentable, :polymorphic => true
validates_as_attachment
end
class SupportingDocument < Document
end