Method: Contentful::Management::Resource::ClassMethods#update_coercions!

Defined in:
lib/contentful/management/resource.rb

#update_coercions!Object

Ensure inherited classes pick up coercions



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/contentful/management/resource.rb', line 316

def update_coercions!
  return if @coercions_updated

  if superclass.respond_to? :property_coercions
    @property_coercions = superclass.property_coercions.dup.merge(@property_coercions || {})
  end

  @sys_coercions = superclass.sys_coercions.dup.merge(@sys_coercions || {}) if superclass.respond_to? :sys_coercions

  if superclass.respond_to? :fields_coercions
    @fields_coercions = superclass.fields_coercions.dup.merge(@fields_coercions || {})
  end

  @coercions_updated = true
end