lib/unimatrix/dynamic_resource.rb in unimatrix-2.2.1 vs lib/unimatrix/dynamic_resource.rb in unimatrix-2.3.1

- old
+ new

@@ -1,40 +1,40 @@ module Unimatrix class DynamicResource < Resource - class << self - + class << self + alias old_new new - + def new( attributes = {}, associations = {} ) - Class.new( self ).old_new( + Class.new( self ).old_new( { type_name: self.name.split( '::' ).last.underscore }. - merge( attributes ), - associations + merge( attributes ), + associations ) end - + end def initialize( attributes = {}, associations = {} ) unsupported_attributes_names = [] attributes.each do | key, value | unsupported_attributes_names << key.to_sym \ unless self.respond_to?( key.to_sym ) end - self.class_eval do + self.class_eval do unsupported_attributes_names.each do | name | - field name + field name end end - super( attributes, associations ) + super( attributes, associations ) yield self if block_given? end end - + end