The error and code is below. Any help would be greatly appreciated.
Error is
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
Extracted source (around line #6):
3: <table>
4: <tr>
5: <% x = 0 %>
6: <% for video in @videos %>
7: <td><%= link_to(image_tag("videos/#{video.video_thumbnail}",
8: :size => '132x99',
9: :border => 5,
Controller is
def selectaction
@video = Video.find :all
end
View is
<table>
<tr>
<% x = 0 %>
<% for video in @videos %>
<td><%= link_to(image_tag("videos/#{video.video_thumbnail}",
:size => '132x99',
:border => 5,
:id => 'thumbnail'),
url_for(:action => 'show', :id => video)
)
%><br>
<b>Title:</b> <%= h video.title %><br>
<b>Host:</b> <%= h video.username %><br>
<b>Views:</b> <%= h video.views %><br>
<b>Skill Level:</b> <%= h video.rating %>/10<br>
<% x = x + 1 %>
<% if x % 2 == 0 %>
<%= "</td></tr><tr>" %>
<% else %>
<%= "</td>" %>
<% end %>
<% end %>
</tr>
</table>
<%= link_to 'Previous page', { :page => @video_pages.current.previous }
if @video_pages.current.previous %>
<%= link_to 'Next page', { :page => @video_pages.current.next } if
@video_pages.current.next %>
<br />
<%= link_to 'New video', :action => 'new' %>