I am trying to write a sample application.
class LineItem< ActiveRecord::Base
belongs_to : order
class Order < ActiveRecord::Base
Now in the controller i am trying :
@ord = Order.new(params[:ord])
@ord.line_item = LineItem.new(params[:lineitem])
redirect_to :action => ‘list’
render :action => ‘new’
and that is giving an exception saying foreign key constraint fails on
line_item because the order_id is 0 and more over the order is not saved
any help ?