On 5 September 2013 17:12, honey ruby <emailtohoneyr...@gmail.com> wrote: > Thanks for your quick responses. Does I get the same id if I use > @whatever.reload. > if that model is accessed often and there are multiple users working on same > model and I want table A id to be saved as new record in table B > Table A > id name email > 878 Sam s...@mail.in.com > > > as I save 878 record in Table A I want that 878 id to be saved as new record > in table B > Table B > id table_a_id > 900 878
As I suggested a little while ago when you first asked this question, but did not reply to my response, you should consider doing this using an association between the tables. Something like table_b belongs_to table_a, table_a has_many table_bs. Then rails will do a lot of the hard work for you. Almost always in rails if you are manipulating id values then you are doing it wrong. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLs7jwBTiOh4dWLCrDEjDQOdfLceSYf9NY1qoTST8f%3DcqA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.