Ruby on Rails Friday, August 30, 2013

On 30 August 2013 09:00, honey ruby <emailtohoneyruby@gmail.com> 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

--
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+unsubscribe@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%3D0gLs40oJi2b1B2de9qJ0MFxk9NRwRAduTaJMpi5SmjOTEtA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment