On 29 April 2015 at 09:17, Jagmeet Singh <[email protected]> wrote: > I am inserting a record in 1st table named as Students and I want to insert > a record in another table with a value coming from a column Refid which is > in Students table
You can create the record using something like Tablename.create(...) By the way, the column should be refid or possibly ref_id, it is best to stick to the rails naming conventions. However if the field refid exists in both tables that strongly suggests there should be some relationship between the tables and you need to sort that out first. If you explain the purpose of the tables we may be able to suggest a better way of doing it. Also the fact that you have to ask the question suggests that maybe you are a beginner in Rails, in which case I suggest you take a few days out to work right through a good tutorial such as railstutorial.org (which is free to use online). The time spent will be recovered very quickly. Cheers 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/473064e8-3e10-471a-8a57-c51a352ba9f4%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLu94-nFmLHT1nRcuHPaDP3FN%3DSbKjr52G00jBmdG8q1%2BA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

