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

CSS The Rails Asset Pipeline and Styling Sass and Rails Add Image Assets and Remove Default Styling

Chris Vukin
Chris Vukin
17,787 Points

odot app broken fresh out of download?

So.. I just downloaded the project files for the rails asset pipeline course. After fixing the secrets.yml issue, I was able to create an account and log in to the app. That's where things stopped working, none of the links are working on the app now, keep getting lots of errors regarding index, anyone else having these issues?

Here is an example of the error:

undefined method `name' for nil:NilClass Extracted source (around line #7): 4 5 6 7 8 9 10

<li id="<%= dom_id(todo_list) %>" class="clearfix">
  <%= link_to todo_list_todo_items_path(todo_list), class: "row" do %>
    <div class="small-10 medium-11 columns truncate" title="<%= todo_list.title %>"><%= todo_list.title %></div>
    <div class="small-2 medium-1 columns"><span class="label round"><%= todo_list.todo_items.size %></span></div>
  <% end %>
</li>

<% end %>

This error persists across several pages when trying to navigate within the app. Any assistance would be great.

Here's how to fix the ODOT app if you're working from Jason's download:

app/views/todo_lists/index.html.erb -- line 3

<% if @todo_lists.count > 0 %>

app/views/todo_lists/_todo_list.html.erb -- line 4

<%= todo_list.todo_items.count %>

app/views/todo_items/index.html.erb -- line 32

<% if @todo_list.todo_items.count > 0 %>

spec/models/user_spec.rb -- line 77 & 81

expect{ user.create_default_lists }.to change{ user.todo_lists.count }.by(1)

spec/models/user_spec.rb -- line 82

expect{ user.create_default_lists }.to change{ user.todo_lists.count }.by(0)

I'm working on updating the app to the current version of rails too.

1 Answer

VISHAL DEEPAK
VISHAL DEEPAK
3,272 Points

I had the same problem , this is how i fixed it

/views/todo_lists/index.html.erb - on line 8 change to this . I changed size to length

 <div class="small-2 medium-1 columns"><span class="label round"><%= todo_list.todo_items.length %></span></div>