class Wishlist < ActiveRecord::Base
  PRIORITIES = ['normal','best in slot','situational','rot']
  
  # Relationships -------------------------------------------------------------
  belongs_to :item
  belongs_to :member
  
  # Attributes ----------------------------------------------------------------
  attr_accessible :item_name, :priority, :note, :member_id
  
  # Validations ---------------------------------------------------------------
  validates_inclusion_of :priority, :in => PRIORITIES, :message => "{{value}} is not a valid entry type", :allow_nil => true
  
  # Callbacks -----------------------------------------------------------------
  
  # Class Methods -------------------------------------------------------------
  
  # Instance Methods ----------------------------------------------------------
  def item_name
    self.item.name unless self.item_id.nil?
  end
  def item_name=(value)
    item = Item.find_or_create_by_name(value)
    self.item = item unless item.nil?
  end
  
  private
    def validate
      errors.add(:item_name, 'is invalid') if self.item_id.nil? or self.item.name.empty?
    end
end

class Wishlist < ActiveRecord::Base
  # Relationships -------------------------------------------------------------
  belongs_to :item
  belongs_to :member
  
  # Attributes ----------------------------------------------------------------
  attr_accessible :item_name, :priority, :note, :member_id
  
  # Validations ---------------------------------------------------------------
  validates_format_of :priority, :with => /^(normal|best in slot|situational|rot)/, :allow_nil => true
  
  # Callbacks -----------------------------------------------------------------
  
  # Class Methods -------------------------------------------------------------
  
  # Instance Methods ----------------------------------------------------------
  def item_name
    self.item.name unless self.item_id.nil?
  end
  def item_name=(value)
    item = Item.find_by_name(value)
    self.item = item unless item.nil?
  end
  
  private
    def validate
      errors.add(:item_name, 'is invalid') if self.item_id.nil? or self.item.name.empty?
    end
end

--- 
+++ 
@@ -1,4 +1,6 @@
 class Wishlist < ActiveRecord::Base
+  PRIORITIES = ['normal','best in slot','situational','rot']
+  
   # Relationships -------------------------------------------------------------
   belongs_to :item
   belongs_to :member
@@ -7,7 +9,7 @@
   attr_accessible :item_name, :priority, :note, :member_id
   
   # Validations ---------------------------------------------------------------
-  validates_format_of :priority, :with => /^(normal|best in slot|situational|rot)/, :allow_nil => true
+  validates_inclusion_of :priority, :in => PRIORITIES, :message => "{{value}} is not a valid entry type", :allow_nil => true
   
   # Callbacks -----------------------------------------------------------------
   
@@ -18,7 +20,7 @@
     self.item.name unless self.item_id.nil?
   end
   def item_name=(value)
-    item = Item.find_by_name(value)
+    item = Item.find_or_create_by_name(value)
     self.item = item unless item.nil?
   end
   
Change validation for type from format_of to inclusion_of; For now, if the item isn't found we're gonna create it. This could lead to all kinds of invalid Item entries being created.
