Insert row in one table and after save I want that Id in another table to be saved

Hi all

There is a scenario with 2 tables.
I will insert the one row in table 1 and after I save my row in table
one I
want that Id to be saved in another table immediately how to approach
this
scenario.
kindly help me

Regards,
Honey

On 30 August 2013 09:00, honey ruby [email protected] wrote:

Hi all

There is a scenario with 2 tables.
I will insert the one row in table 1 and after I save my row in table one I
want that Id to be saved in another table immediately how to approach this
scenario.

Which bit don’t you know how to do?
Where to put the code?
How to determine the id of the row?
How to find the record in the second table?
How to change the value in the second table?
How to save the value in the second table?
Something else?

But before that the more important question is whether you should have
a belongs_to, has_many (or similar) association between the tables so
that rails will do most of the work for you.

Colin