[RUBY]: Duplicate the database record to the same table

Example: 
@user = Users.find(params[:id])
@user_new = User.new(@user.attributes)
@user.created_at = Time.now #update the field in the new record
@user_new.save

No comments:

Post a Comment