Initialising has_many through joins


What is the quick and tidy way to initialise has_many through

What I need is a form that edits the join so where no join exists a
blank field is initialised. Now using accepts_nested_attributes_for and
fields for this is very tidy and easy for existing fields, but how do I
initialise those joins as empty fields without saving them?

Something like


order has_many order_items
order has_many items through order_items


def edit
@order = Order.find(params(id)
@order.items.merge(Items.find(:all)) # something along these lines


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs