Hi, I have a real simple association setup here that's just trying to: - Create a new PayjunctionOrder - Create some LineItem objects and assign them to the PayjunctionOrder - Save everything
I'm using Rails Edge.
Hi, I have a real simple association setup here that's just trying to: - Create a new PayjunctionOrder - Create some LineItem objects and assign them to the PayjunctionOrder - Save everything
I'm using Rails Edge.
Here are the table schemas for reference:
create_table "line_items", :force => true do |t| t.column "product_id", :integer, :default => 0, :null => false t.column "order_id", :integer, :default => 0, :null => false t.column "quantity", :integer, :default => 0, :null => false t.column "total_price", :decimal, :precision => 8, :scale => 2, :default => 0.0, :null => false end
create_table "payjunction_orders", :force => true do |t| t.column "total_amount", :decimal, :precision => 8, :scale => 2, :default => 0.0, :null => false t.column "response_code", :string, :limit => 5, :default => "", :null => false t.column "response_message", :string t.column "tracking_code", :string, :limit => 15 t.column "cc_last_four", :string, :limit => 22 t.column "first_name", :string, :limit => 30 t.column "last_name", :string, :limit => 20 t.column "email", :string, :limit => 30 end
I finally got this sorted, so here's the solution for anyone else with this problem.
Seems that the parent class also needs to know what the foreign key is called in the child. So, you'd need the following: