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 trialJoshua Atteberry
6,250 PointsThe action 'show' could not be found for TodoItemsController
This error shows up when I run my spec and also when I click "Mark Complete" on the page.
complete_spec.rb
it "is successful when marking a single item complete" do
expect(todo_item.completed_at).to be_nil
visit_todo_list todo_list
within dom_id_for(todo_item) do
click_link "Mark Complete"
end
todo_item.reload
expect(todo_item.completed_at).to_not be_nil
end
todo_items_controller.rb
def complete
@todo_item = @todo_list.todo_items.find(params[:id])
@todo_item.update_attribute(:completed_at, Time.now)
redirect_to todo_list_todo_item_path, notice: "Todo item marked as complete"
end
todo_items/index.html.erb
<%= link_to "Mark Complete", complete_todo_list_todo_item_path(todo_item), method: :patch %>
2 Answers
Maciej Czuchnowski
36,441 PointsIn this line:
redirect_to todo_list_todo_item_path, notice: "Todo item marked as complete"
You specified that you want show path for one item (todo_list_todo_item_path), but did not pass any item inside or any list as arguments.You can also redirect to the item index for this particular list: todo_list_todo_items_path(@todo_list) (notice plural of 'items' - these things matter).
Aidan O'Leary
12,313 PointsThanks it worked for me as well.
Joshua Atteberry
6,250 PointsJoshua Atteberry
6,250 PointsThank you, adding an 's' worked. I'm always messing up my plurals!