Module: MDEXClient::ActiveRecord::Searchable::InstanceMethods

Defined in:
lib/mdex_client/active_record/extensions.rb

Instance Method Summary collapse

Instance Method Details

#mdex_attributes=(attributes) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mdex_client/active_record/extensions.rb', line 59

def mdex_attributes=(attributes)
  mapping = self.class.mdex_field_mapping
  unmapped_attributes = self.class.mdex_additional_record_attributes
  
  attributes.each do |key, value|
    next if unmapped_attributes.include? key
    
    unless mapping[key]
      logger.warn "No MDEX field mapping for #{key} in #{self.class.name}, skipping"
      next
    end
    
    send("#{mapping[key]}=", value)
  end
end