все, что я хочу, это дублировать существующую запись.Он должен отобразить новую форму с заполненными данными и позволить мне «Создать» эту новую запись.
def clone
@agreement = Agreement.find_by_slug!(params[:id])
@agreement.clone
respond_to do |format|
format.html { render action: "new", notice: 'Agreement was successfully cloned.' }
end
end
Моя модель
def clone
self.dup()
self.slug = nil
end
Я получаю эту ошибку:
No route matches {:action=>"show", :controller=>"agreements", :format=>nil, :id=>#<Agreement id: 1, date: "2011-12-18",...`
Маршруты
resources :agreements do
member do
post 'approve'
get 'clone', :controller => 'agreements', :action => 'clone'
end
end