Skip to content

Instantly share code, notes, and snippets.

@benphelps
Created August 28, 2012 15:05
Show Gist options
  • Save benphelps/3498879 to your computer and use it in GitHub Desktop.
Save benphelps/3498879 to your computer and use it in GitHub Desktop.
class Armor < ActiveRecord::Base
attr_accessible :back_id, :character_id, :chest_id, :feet_id, :hand_id, :head_id, :legs_id, :shoulder_id, :waist_id
belongs_to :character
belongs_to :back, :class_name => 'ArmorItem'
belongs_to :chest, :class_name => 'ArmorItem'
belongs_to :feet, :class_name => 'ArmorItem'
belongs_to :hand, :class_name => 'ArmorItem'
belongs_to :head, :class_name => 'ArmorItem'
belongs_to :legs, :class_name => 'ArmorItem'
belongs_to :shoulder, :class_name => 'ArmorItem'
belongs_to :waist, :class_name => 'ArmorItem'
end
class ArmorItem < ActiveRecord::Base
attr_accessible :armor_tier_id, :bonus_id, :enchant_id
belongs_to :armor_tier
belongs_to :enchant
belongs_to :bonus
end
class ArmorMaterial < ActiveRecord::Base
attr_accessible :name
has_many :armor_tiers
end
class ArmorTier < ActiveRecord::Base
attr_accessible :agility, :deviation, :intellect, :level, :name, :stamina, :strength
belongs_to :armor_material
end
class Bonus < ActiveRecord::Base
attr_accessible :agility, :intellect, :name, :stamina, :strength
has_many :armor_items
end
class Enchant < ActiveRecord::Base
attr_accessible :agility, :intellect, :name, :stamina, :strength
has_many :armor_items
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment