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:
4:
5: <% x = 0 %>
6: <% for video in @videos %>
7: <%= 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
<% x = 0 %>
<% for video in @videos %>
<%= link_to(image_tag("videos/#{video.video_thumbnail}",
:size => '132x99',
:border => 5,
:id => 'thumbnail'),
url_for(:action => 'show', :id => video)
)
%>
Title: <%= h video.title %>
Host: <%= h video.username %>
Views: <%= h video.views %>
Skill Level: <%= h video.rating %>/10
<% x = x + 1 %>
<% if x % 2 == 0 %>
<%= " |
" %>
<% else %>
<%= "" %>
<% end %>
<% end %>
<%= 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 %>
<%= link_to ‘New video’, :action => ‘new’ %>
|