I have a nested form and once I save, I want to be able to click a link on the show page to copy or clone that form and open a new one. From there I should be able to make e
Also worth mentioning is the dup
method on a model. It makes a copy with all attributes and outgoing relations but sets id
to nil
. Like this (borrowing code from Naren Sisodiya):
def create_from_existing
@existing_post = Post.find(params[:id])
#create new object with attributes of existing record
@post = @existing_post.dup
render "your_post_form"
end