Created
January 31, 2012 03:31
-
-
Save tdouce/1708577 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Individual < ActiveRecord::Base | |
#attr_writer :train | |
#attr_accessor :trained | |
#attr_accessible :trained | |
#attr_protected :trained | |
before_update :untrain | |
validates :height, :presence => true, :numericality => true | |
validates :weight, :presence => true, :numericality => true | |
validates :gender, :presence => true | |
MALE = 'Male' | |
FEMALE = 'Female' | |
MALEPROB = 0.5 | |
FEMALEPROB = 0.5 | |
GENDERS = [ MALE, FEMALE ] | |
scope :untrained, Individual.where( :trained => false ) | |
scope :gender, lambda { |gender| where("gender = ?", gender ) } | |
private | |
def untrain | |
#self.update_attributes( :trained => false ) | |
self.trained = false | |
#a.save | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment