Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created September 25, 2008 22:21
Show Gist options
  • Save deadprogram/12966 to your computer and use it in GitHub Desktop.
Save deadprogram/12966 to your computer and use it in GitHub Desktop.
class VitalStatType
attr_accessor :title, :possible_values
def conditions
end
end
class VitalStatSelectType < VitalStatType
def conditions
end
end
class VitalStatMultipleSelectType < VitalStatType
def conditions
end
end
class VitalStatNumberType < VitalStatType
def conditions
end
end
VitalStat::Gender = VitalStatSelectType.new(:title => 'Gender', :possible_values => {:male => 'Male', :female => 'Female'})
VitalStat::Age = VitalStatNumberType.new(:title => 'Age')
VitalStat::Ethnicity = VitalStatMultipleSelectType.new(:title => 'Ethnicity', :possible_values =>
{ :african_american => 'African American',
:american_indian => 'American Indian',
:asian => 'Asian',
:white => 'White/Caucasian',
:east_indian => 'East Indian'
})
class VitalStat < ActiveRecord::Base
VitalStatTypes = {
:gender => [Gender, 1],
:age => [Age, 2],
:ethnicity => [Ethnicity, 3]
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment