Answer the question
In order to leave comments, you need to log in
How to add records to two tables?
Hello everyone) In general, the situation is this, there is a User and Student table. Student has a user_id. I want to make it so that when saving a record in User , the id of the just saved user appears in the user_id field in the Student table. Tried to do with callbacks, but something doesn't work. Has anyone implemented something similar? Share your experience. Thanks in advance)
Answer the question
In order to leave comments, you need to log in
Show me how you implemented it with callbacks.
Do you get
class User
has_one/has_many :students
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question