Skip to content

Instantly share code, notes, and snippets.

@benphelps
Created August 29, 2012 02:37
Show Gist options
  • Save benphelps/3506254 to your computer and use it in GitHub Desktop.
Save benphelps/3506254 to your computer and use it in GitHub Desktop.
class ArmorItem < ActiveRecord::Base
attr_accessible :armor_tier_id, :bonus_id, :enchant_id, :name, :stat_set_id
belongs_to :armor_tier
belongs_to :enchant
belongs_to :bonus
belongs_to :stat_set
attr_reader :stat, :agility
def stat
StatSet.find(stat_set_id)
end
def agility
ArmorTier.find(armor_tier_id).agility + StatSet.find(stat_set_id).agility
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment