15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/person_name.rb', line 15
def has_person_name(*name_types)
name_types = name_types.to_a.flatten.compact.map(&:to_sym)
name_types << :name if name_types.empty?
if has_person_names?
write_inheritable_attribute(:name_types, (self.name_types + name_types).uniq)
else
write_inheritable_attribute(:name_types, name_types)
class_inheritable_reader(:name_types)
class_eval do
def self.has_person_names?
true
end
include PersonName::ActiveRecord::Core
end
end
end
|