diff --git a/lib/rails_erd/domain/specialization.rb b/lib/rails_erd/domain/specialization.rb index 4ee682b6..6938793c 100644 --- a/lib/rails_erd/domain/specialization.rb +++ b/lib/rails_erd/domain/specialization.rb @@ -49,7 +49,9 @@ def abstract_from_models(domain, models) attr_reader :specialized def initialize(domain, generalized, specialized) # @private :nodoc: - @domain, @generalized, @specialized = domain, generalized, specialized + @domain = domain + @generalized = generalized || NullGeneralized.new + @specialized = specialized || NullSpecialization.new end def generalization? @@ -66,5 +68,17 @@ def <=>(other) # @private :nodoc: (generalized.name <=> other.generalized.name).nonzero? or (specialized.name <=> other.specialized.name) end end + + class NullSpecialization + def name + "" + end + end + + class NullGeneralized + def name + "" + end + end end end