Sha256: 234655ca6494a6f8f5e9a674fcb82dac3063e0d26bd5c138b427f238280eb4ed
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module AxleAttributes class Definition module Mappings extend ActiveSupport::Concern included do class_attribute :cached_attribute_mappings self.cached_attribute_mappings = {} end module ClassMethods def cached_attribute_mappings_for(namespace) cached_attribute_mappings[namespace] ||= AttributeMapping.cached_mapping_for(namespace).read end end def to_options mappings.map do |k, v| [v, k] end end def mappings if @mappings @mappings elsif mapping_model && mapping_model.respond_to?(:cached_mapping) mapping_model.cached_mapping else self.class.cached_attribute_mappings_for(namespace)[name] || {} end end def mappings=(val) @mappings = val end def mapping_records AttributeMapping.where(namespace: namespace, attribute_name: name) end def mapping_model if options[:mapping_model] @mapping_model ||= options[:mapping_model].constantize end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axle_attributes-1.13.2 | lib/axle_attributes/definition/mappings.rb |