Home>

I want to duplicate a record, but it doesn't pull the parameters.

What I tried

def update_new
    @retrieve_list = RetrieveList.new
    @retrieve_list = RetrieveList.find (params [: id]). dup
    @ retrieve_list.save
  end


I tried to write this on the SHOW screen.

def show
    @retrieve_list = RetrieveList.new
    @retrieve_list = RetrieveList.find (params [: id]). dup
    @ retrieve_list.save
  end


In this case, Link_to pulled the ID.
However, every time I go to the show screen, it is duplicated, which is a big deal.
The ideal is the former, and if you pull the ID, it seems to succeed ...

If i can teach me something with these tips, I would appreciate it.