Sha256: dc1d61f49030ddb681c363de2d97ede10dd439a737457b32052d1ae8119021ed
Contents?: true
Size: 680 Bytes
Versions: 7
Compression:
Stored size: 680 Bytes
Contents
require 'earth/model' class FoodGroup < ActiveRecord::Base extend Earth::Model TABLE_STRUCTURE = <<-EOS CREATE TABLE food_groups ( name CHARACTER VARYING(255) NOT NULL PRIMARY KEY, intensity FLOAT, intensity_units CHARACTER VARYING(255), energy FLOAT, energy_units CHARACTER VARYING(255), suggested_imperial_measurement CHARACTER VARYING(255) ); EOS self.primary_key = "name" class << self def names all.map(&:name) end def [](name) find_by_name name.to_s end end warn_unless_size 10 end
Version data entries
7 entries across 7 versions & 1 rubygems