Displaying 1 result from an estimated 1 matches for "deliveryitem".
2011 Jul 25
1
3 models in a form.
Hello,
class Customer < ActiveRecord::Base
has_many :deliveries
class Delivery < ActiveRecord::Base
has_many :delivery_items
has_many :products, :through => :delivery_items
belongs_to :customer
class DeliveryItem < ActiveRecord::Base
belongs_to :delivery
belongs_to :product
I create a new delivery for customer x:
= simple_form_for @customer do |f|
= f.simple_fields_for :deliveries do |deliveries_f|
.block
.column.span-12
= deliveries_f.association :products, :multiple => true,
:sel...