Sha256: 15ae0952da8eebdb6f724bf6f7d9b01e919f30e47bc94278e7c022ca8402cfc4

Contents?: true

Size: 561 Bytes

Versions: 11

Compression:

Stored size: 561 Bytes

Contents

require 'pet'

class PetRecord < ActiveRecord::Base
  include Sniff::Emitter
  include BrighterPlanet::Pet
  
  belongs_to :species
  belongs_to :breed
  belongs_to :gender
  
  conversion_accessor :weight, :external => :pounds, :internal => :kilograms
  
  def scope_conditions_for(assoc)
    if assoc == :breeds and species
      { :species_id => species.id }
    else
      {}
    end
  end
  
  def weight_range
    species.minimum_weight..species.maximum_weight if species
  end
  
  class << self
    def fallback
      Species.fallback
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pet-0.0.13 lib/test_support/pet_record.rb
pet-0.0.12 lib/test_support/pet_record.rb
pet-0.0.11 lib/test_support/pet_record.rb
pet-0.0.10 lib/test_support/pet_record.rb
pet-0.0.9 lib/test_support/pet_record.rb
pet-0.0.8 lib/test_support/pet_record.rb
pet-0.0.7 lib/test_support/pet_record.rb
pet-0.0.6 lib/test_support/pet_record.rb
pet-0.0.5 lib/test_support/pet_record.rb
pet-0.0.4 lib/test_support/pet_record.rb
pet-0.0.3 lib/test_support/pet_record.rb