Displaying 1 result from an estimated 1 matches for "checkout_complete".
2006 Dec 07
2
Problem saving parent and children using belongs_to, class_name, and foreign_key
...has_many :line_items
end
------------------
----
class LineItem < ActiveRecord::Base
belongs_to :order,
:class_name => "PayjunctionOrder",
:foreign_key => "order_id"
...
------------------
----
class StoreController < ApplicationController
def checkout_complete
...
@order = PayjunctionOrder.new
@order.line_items << LineItem.new(:product => product, :quantity =>
qty, :total_price => product.price * qty)
@order.save!
...
------------------
When I try to save, I get:
Mysql::Error: #23000Column ''order_id'' cannot...