25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/concerns/model/base_thing.rb', line 25
def list
return self.to_s.constantize.list_instance if self.to_s.constantize.list_instance.present?
attributes = {
adjective: 'best', topic: self.to_s, scope: 'ever', thing_type: self.to_s,
negative_adjective: 'worst'
}
self.to_s.constantize.list_instance = List.where(attributes).first
unless self.to_s.constantize.list_instance.present?
self.to_s.constantize.list_instance = List.create!(attributes)
end
self.to_s.constantize.list_instance
end
|