Copy contents from one table to the other

hello frnds

I want to first connect to one table then fetch the desired
value…store that in variable and then copy the contents of that
variable to another table. Can you tell me how to do that?

Thanks

Dhaval P.

ok let me understand it
dhval has table_1 and table_2
hes saving some fields in table_1 which is in the
instance_variable(object)
called abc
now he wants to save the contents of object abc in table_2
ok
in this case we can use after_save
which saves the passed parameters in the mentioned table from table 1
i hope it works
do mail me back if it doenst
have fun

On 9/5/07, Dhaval P. [email protected] wrote:

Dhaval P.

Posted via http://www.ruby-forum.com/.


Piyush
09916133729

Yes what you have understood is perfect but then can you give me an
example with coding then that will be gr8 as i havent used after_save
method b4…

Thanks

Dhaval P.

have A loook at http://api.rubyonrails.org/
sarch for after_save
then u can pass the parametrs which you want to

somewhat like
Table2.create(:table1_id => table1_id,
:id => table1.id,
)

i hope it works
u may use after_create
check the api link and figure out which suits u the best

see ya
have fun

On 9/5/07, Dhaval P. [email protected] wrote:

Posted via http://www.ruby-forum.com/.


Piyush
09916133729

Thanks again

this is much clearer but the thing is that i dont want to create table
dynamically.I just want to copy the contents to a table that is already
created say suppose i have one value in @email which stores the email
address then i want to copy that value to the email field in table2 the
structure of which is already created…hope this is clear

thanks

Dhaval P.