class Item < ActiveRecord::Base
  belongs_to :order
  belongs_to :product
  has_many :pieces
  has_many :entries

  attr_accessible :item_pieces, :item_entries

  validates_presence_of :order_id
  validates_presence_of :product_id
  validates_presence_of :item_pieces #, :if => Proc.new {|item| !item.product or !item.product.properties.blank? }
  validates_presence_of :item_entries

...
end


def add_item
  # TODO: move this crap to the model!
  @order = Order.find(params[:id])
  @customer = @order.customer
  @item = @order.items.new(params[:item])

  @item.save
end


# params coming through

# Parameters: {"product_id"=>"1", "action"=>"add_item", "pieces"=>{"22"=>"38", "23"=>"43", "24"=>"41"}, "id"=>"195", "controller"=>"orders", "item"=>{"product_id"=>"1", "quantity"=>""}, "entries"=>{"27"=>"20 Characters only", "28"=>"25 Uppercase or 35 Lower case", "29"=>"12 Lower case only"}}