I cannot edit records for nested model. I have two models... Document
and Contentitem. Document has_many Contentitems.
The following link on the Document show page...
<%= link_to ''Edit'', [@document, content], :method =>
:edit %>
Causes the following error...
No route matches "/documents/1/contentitems/9"
This is what I have... any ideas?
========= routes.rb =============
Dg::Application.routes.draw do
root :to => "documents#index"
resources :templategroups do
resources :templateitems
end
resources :documents do
resources :contentitems
member do
put ''insert_into''
put ''sort''
end
end
end
========== contentitems_controller ======
class ContentitemsController < ApplicationController
before_filter :load_document
...
def edit
@contentitem = @document.contentitems.find(params[:contentitem])
end
...
private
def load_document
@document = Document.find(params[:document_id])
end
end
=========
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.