Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created September 25, 2008 21:54
Show Gist options
  • Save deadprogram/12954 to your computer and use it in GitHub Desktop.
Save deadprogram/12954 to your computer and use it in GitHub Desktop.
class VitalStatType
attr_accessor :title, :value_type. :possible_values
end
VitalStat::Gender = VitalStatType.new(:title => 'Gender', :value_type => :select, :possible_values => {:male => 'Male', :female => 'Female'})
VitalStat::Age = VitalStatType.new(:title => 'Age', :value_type => :number)
VitalStat::Ethnicity = VitalStatType.new(:title => 'Ethnicity', :value_type => :multiple, :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