Method: ActiveEntity::Inheritance::ClassMethods#new

Defined in:
lib/active_entity/inheritance.rb

#new(attributes = nil, &block) ⇒ Object

Determines if one of the attributes passed in is the inheritance column, and if the inheritance column is attr accessible, it initializes an instance of the given subclass instead of the base class.



44
45
46
47
48
49
50
# File 'lib/active_entity/inheritance.rb', line 44

def new(attributes = nil, &block)
  if abstract_class? || self == Base
    raise NotImplementedError, "#{self} is an abstract class and cannot be instantiated."
  end

  super
end