Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Editing Todo Items

John Salzarulo
John Salzarulo
6,596 Points

I am assuming I have routing issues in my app. Not sure what broke.

What is going on?

I made it to this video and while playing with my app to be sure everything is working and not just passing tests I can see that my "List items" link within the index of the to do lists just keeps showing the same list. It's always the first list in the array.

What I have done:

  • I have checked my routing, I think it's right.
  • I have checked the link syntax in the index view page, I think it's right.

Here is my github repository

What do you guys think? Please help. I've been trying to fix this for hours.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Make sure you download the code from that stage provided by Jason (under the video in the Download section) and compare his files with your files.

John Salzarulo
John Salzarulo
6,596 Points

Will do. Thanks for the tip.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Also, if it turns out your code is identical, try running Jason's app to see if he has the same behavior and let me know here what you find.

2 Answers

John Salzarulo
John Salzarulo
6,596 Points

Found it.

I was able to find it using "DiffMerge" - A great free tool if you don't have it. I checked myself against the provided application files. I found the following error.

I had this:

class TodoItemsController < ApplicationController
  def index
    @todo_list = TodoList.find{params[:todo_list_id]}
  end

  def new 
    @todo_list = TodoList.find{params[:todo_list_id]}
    @todo_item = @todo_list.todo_items.new
  end

It should have been this:

class TodoItemsController < ApplicationController
  def index
    @todo_list = TodoList.find(params[:todo_list_id])
  end

  def new 
    @todo_list = TodoList.find(params[:todo_list_id])
    @todo_item = @todo_list.todo_items.new
  end

The difference was using { } instead of ( ). Should of known better. Thank you treehouse community!

Ricardo Acuna
Ricardo Acuna
9,014 Points

You have a typo in your code:

<li><%= link_to "List items", todo_list_todo_items_path(todo_list) %></li>

Should be:

<li><%= link_to "List Items", todo_list_todo_items_path(todo_list) %></li>
John Salzarulo
John Salzarulo
6,596 Points

Thanks for catching that... Didn't fix the routing issue though... Still looking into that.