I generated a scaffold and I created a casual application. I want to list the scaffold items on a sidebar, everywhere on the application (inside application.html.erb). My left column, in application.html.erb looks like that:
> <div id="leftcolumn">
> <% @items.each do |link| %>
> <%= link_to link.title, link %>
> <% end %>
> </div>
Clicking on each item would lead to it's Show method. After running that, whenever I try to access any method of any item, it shows me the following error:
> NoMethodError in Items#show
>
> Showing F:/Rails/items-list/app/views/layouts/application.html.erb
> where line #17 raised:
>
> You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.each
And the followed code is the left column's code. How can I fix that?