Displaying 1 result from an estimated 1 matches for "find_all_by_item_type".
2008 Oct 07
0
associations not saved in migration
...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 = type.id
puts "item: #{item.name}, type id: #{item.menu_item_type_id}"
item.save!
end
type = MenuItemType.create :name => '...