Displaying 1 result from an estimated 1 matches for "cmp_code".
Did you mean:
cmd_code
2006 Jun 17
2
how to delete a parent record and child records?
...#39;' link on one (of a list) of parent MySQL records, the children
records in a different table get deleted also.
Very simple setup: my tables are ''customers'' and ''accounts''
class Customer < ActiveRecord::Base
has_many :accounts, :order => "cmp_code"
end
class Account < ActiveRecord::Base
belongs_to :customer
end
I used migrate to create the tables.
The table ''accounts'' has a field called customer_id (int).
It was easy to add a "add new account to this customer" form to the
show.rhtml for my ''...