Sha256: 5e37a31fb7c5ad99ad80d8799ec0aa504ac6d33cb70460492bfcc0fc4da101c0

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

PETS = File.expand_path('../pets.csv', __FILE__)
PETS_FUNNY = File.expand_path('../pets_funny.csv', __FILE__)
COLOR_DICTIONARY_ENGLISH = File.expand_path('../pet_color_dictionary.en.csv', __FILE__)
COLOR_DICTIONARY_SPANISH = File.expand_path('../pet_color_dictionary.es.csv', __FILE__)

class Pet < ActiveRecord::Base
  self.primary_key = "name"
  col :name
  col :breed_id
  col :color_id
  col :age, :type => :integer
  col :age_units
  col :weight, :type => :float
  col :weight_units
  col :height, :type => :float
  col :height_units
  col :favorite_food
  col :command_phrase
  belongs_to :breed
  data_miner do
    process :auto_upgrade!
    process :run_data_miner_on_parent_associations!
    import("A list of pets", :url => "file://#{PETS}") do
      key :name
      store :age, :units_field_name => 'age_units'
      store :breed_id, :field_name => :breed, :nullify_blank_strings => true
      store :color_id, :field_name => :color, :dictionary => { :url => "file://#{COLOR_DICTIONARY_ENGLISH}", :input => :input, :output => :output }
      store :weight, :from_units => :pounds, :to_units => :kilograms
      store :favorite_food, :nullify_blank_strings => true
      store :command_phrase
      store :height, :units => :millimetres
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
data_miner-2.5.2 test/support/pet.rb
data_miner-2.5.1 test/support/pet.rb
data_miner-2.5.0 test/support/pet.rb
data_miner-2.4.1 test/support/pet.rb
data_miner-2.4.0 test/support/pet.rb
data_miner-2.3.4 test/support/pet.rb
data_miner-2.3.2 test/support/pet.rb
data_miner-2.3.1 test/support/pet.rb
data_miner-2.3.0 test/support/pet.rb
data_miner-2.2.0 test/support/pet.rb