8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/types/paranoid_boolean.rb', line 8
def self.bind(property)
model = property.model
repository = property.repository
model.send(:set_paranoid_property, property.name){true}
model.class_eval <<-EOS, __FILE__, __LINE__
def self.with_deleted
with_exclusive_scope(#{property.name.inspect} => true) do
yield
end
end
def destroy
self.class.paranoid_properties.each do |name, blk|
attribute_set(name, blk.call(self))
end
save
end
EOS
model.default_scope(repository.name).update(property.name => false)
end
|