Nested Resource Check List

Posted by Rob Kaufman
on Oct 04, 07

I want to get back to this and make a generator for it, but for now here is my checklist based mostly off of this post.

  1. Create resource scaffolding ruby script/generate scaffold_resource Nestee title:string body:text
  2. ruby script/generate scaffold_resource Nester body:text
  3. Setup relationships in models
  4. Modify Routes
  5. Modify controller of nested resource
    1. add before_filter to assign nestee
      1. include @nester = @nestee.nester.find(params[:id]) if params[:id]
    2. ammend the *_url calls with @parent
    3. remove all instances of Nester.find(params[:id])
    4. scope the nested class finder_all with the nestee
  6. Modify the views of nested resource
    1. edit.rhtml - formfor, linkto 'show'
    2. show.rhtml - link_to 'edit' (at bottom)
    3. index.rhtml - linkto 'edit' and linkto 'destroy'
  7. Provide links to nested resource
Comments

Leave a response

Comment