when the join model is created............

In a has_many :through association the join model is automatically created.
But...how the parameters are passed to the model?
For example, if I have
Model1
has_many :models
has_many :models2, through => :models

and

Model2
has_many :models
has_many :model1, through => :models

The join model is Model.

and I create a new Model1, how params model1_id and model2_id are
passed to model Model?

I want to manage them in a after_save callback of the join model.
How can I do that?

Hi,
   When you will create the object of model1 at that time you have to
just assign the related records of models2.

For eg.

model1 = Model1.new(...)
model1.model2_ids = [selected object id of model2]
model1.save

It automatically handles the association between currently created
object
of model1 and model2. Then after look at your intermediate table and it
will show the related ids of both the tables.