Sha256: 19c375494342dad2dc81d9582112869e4aa918dc9e1998cb9829fab666e4c444
Contents?: true
Size: 1.25 KB
Versions: 30
Compression:
Stored size: 1.25 KB
Contents
module Gummi module DbLayer module Document module Attributes extend ActiveSupport::Concern module ClassMethods def mapping_for_attribute(attribute) if attribute.is_a? Virtus::Attribute::EmbeddedValue { properties: attribute.primitive.mapping } elsif attribute.is_a? Virtus::Attribute::Collection mapping_for_attribute(attribute.member_type) else begin attribute.mapping rescue NoMethodError => exception if exception.message.include?("`mapping'") raise Errors::ImplicitMappingForbidden, "Sorry, you have to explicitly define the attribute type for #{attribute.instance_variable_name rescue nil} in #{self} or maybe you tried to use Array[] where it is not allowed. Original Exception: #{exception.message}" else raise exception end end end end def mapping result = {} attribute_set.each do |attribute| result.merge! attribute.name => mapping_for_attribute(attribute) end result end end end end end end
Version data entries
30 entries across 30 versions & 1 rubygems