Does rails have a way to insert records from a model instance? Something like User.create(user)?
Does rails have a way to insert records from a model instance? Something like
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You would just use
user.saveassuming thatuseris an instance ofUser. AR knows whether to insert or update.UPDATE (see comments)
This seemed to be a clone of a record issue, so the answer was to use
dupmethod to create a shallow clone of the object.