Sha256: 789e8dfd171d59e4433ace031bb3615f68c96e46fa90938d85b769f673beb3a7
Contents?: true
Size: 793 Bytes
Versions: 3
Compression:
Stored size: 793 Bytes
Contents
# frozen_string_literal: true module CustomFieldsRelatableExtension def resolve_name(mod, name) super rescue NameError => e return name.constantize if name =~ CustomFields::KLASS_REGEXP raise e end def validate! option = @options.delete(:custom_fields_parent_klass) super.tap do @options[:custom_fields_parent_klass] = option if option end end end [ Mongoid::Association::Embedded::EmbeddedIn, Mongoid::Association::Embedded::EmbedsMany, Mongoid::Association::Embedded::EmbedsOne, Mongoid::Association::Referenced::BelongsTo, Mongoid::Association::Referenced::HasMany, Mongoid::Association::Referenced::HasAndBelongsToMany, Mongoid::Association::Referenced::HasOne, ].each do |klass| klass.prepend CustomFieldsRelatableExtension end
Version data entries
3 entries across 3 versions & 1 rubygems