7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/softie.rb', line 7
def softie(options = {})
class_attribute :softie_options
self.softie_options = {
key: :deleted_at,
scope: :active,
deleted_by_class: nil,
deleted_by_key: :deleted_by
}.merge(options)
key softie_options[:key], Time
if softie_options[:deleted_by_class]
key softie_options[:deleted_by_key],
softie_options[:deleted_by_class]
end
scope softie_options[:scope], lambda {
where(softie_options[:key] => nil)
} if softie_options[:scope]
end
|