Created
August 29, 2012 03:48
-
-
Save benphelps/3506610 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 Armor < ActiveRecord::Base | |
attr_accessible :back_id, :character_id, :chest_id, :feet_id, :hands_id, :head_id, :legs_id, :shoulder_id, :waist_id, :finger_id | |
belongs_to :character | |
[:back, :chest, :feet, :hands, :head, :legs, :shoulder, :waist, :finger].each do |part| | |
belongs_to part, :class_name => 'ArmorItem' | |
define_method part do | |
# what do I place here? I'm using :class_name to route it to an ArmorItem | |
ArmorItem.find(:part[_id]) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment