class Product < ActiveRecord::Base 
  translates :name 
end

class CreateProducts < ActiveRecord::Migration 
  def self.up 
    create_table :products do |t| 
      t.column :name, :string 
      t.column :unit_price, :integer 
      t.column :quantity_on_hand, :integer 
      t.column :updated_at, :datetime 
    end 
    
    Locale.set('pl') 
    Product.new do |product| 
      product.name = 'Mała czarna książka' 
      product.unit_price = 999 
      product.quantity_on_hand = 9999 
      product.save 
    end 
    
    Locale.set('en-US') 
    product = Product.find(:first) 
    product.name = 'Little Black Book' 
    product.save 
  end 

  def self.down 
    drop_table :products 
  end 
end