Revision cfd1c413
Added by Tomáš Strachota about 9 years ago
app/models/concerns/foreman/sti.rb | ||
---|---|---|
module ClassMethods
|
||
# ensures that the correct STI object is created when :type is passed.
|
||
def new_with_cast(*attributes, &block)
|
||
if (h = attributes.first).is_a?(Hash) && (type = h.delete(:type)) && type.length > 0
|
||
if (h = attributes.first).is_a?(Hash) && (type = h.with_indifferent_access.delete(:type)) && type.length > 0
|
||
if (klass = type.constantize) != self
|
||
raise "Invalid type #{type}" unless klass <= self
|
||
return klass.new(*attributes, &block)
|
Also available in: Unified diff
Fixes #9657 - merge NICs from compute profile in host create API
- updated api docs for hosts and interfaces
- host create/update api actions now merge interfaces from compute
profiles
- NIC type mapping extracted into a separate class
- return full host detail after host update