all I want is duplicate an existing record. It should render new form with populated data and let me 'Create' this new record.
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
My Model
def clone
self.dup()
self.slug = nil
end
I get this error:
No route matches {:action=>"show", :controller=>"agreements", :format=>nil, :id=>#<Agreement id: 1, date: "2011-12-18",...`
Routes
resources :agreements do
member do
post 'approve'
get 'clone', :controller => 'agreements', :action => 'clone'
end
end