Displaying 1 result from an estimated 1 matches for "createtestmenuitemtypes".
2008 Oct 07
0
associations not saved in migration
...nu_items, :deli_id, :integer
    # todo - the code below doesn''t work, wtf?
    deli = Deli.find(:first)
    items = MenuItem.find(:all)
    for item in items do
      item.deli = deli
      item.save!
    end
  end
  def self.down
    remove_column :menu_items, :deli_id
  end
end
class CreateTestMenuItemTypes < ActiveRecord::Migration
  def self.up
    type = MenuItemType.create :name => ''Sandwiches''
    items = MenuItem.find_all_by_item_type "Sandwhich"
    for item in items do
      puts "item: #{item.name}, type id: #{type.id}"
      item.menu_item_type_id...