Skip to content

Instantly share code, notes, and snippets.

@universal
Created April 14, 2014 11:28
Show Gist options
  • Save universal/10639664 to your computer and use it in GitHub Desktop.
Save universal/10639664 to your computer and use it in GitHub Desktop.
def show
@video = Video.find(params[:id])
@related = @video.find_related_tags.limit(4)
end
=====
<h4>Similar videos:</h4>
<ul class="large-block-grid-4 small-block-grid-2 medium-block-grid-3">
<%= @related.size %>
<% if @related_videos == nil %>
<% @video.find_related_tags.limit(4).each do |video| %>
<li>
<div class="a-video">
<%= link_to video do %>
<div class="video-image text-center" style="background-image: url('<%= video.thumbnails[2].url%>')">
<p class="views"><%= video.views %> views</p>
<p class="duration"><%= video.duration %></p>
</div>
<% end %>
<div class="title">
<p class="title-and-artist">
<%= link_to video.title, video, {:class=>"video-title"} %> </br >by
<%= link_to video.artist.name, video.artist, {:class=>"artist-name"} %>
<br />
<em>
tags:
<% if video.tag_list.size > 0 %>
<%= video.tag_list %>
<% else %>
none
<% end %>
</em>
</p>
</div>
</div>
</li>
<% end %>
</ul>
<% else %>
<h5>None<h5>
<% end %>
=====
/app/views/videos/show.html.erb where line #51 raised:
SQLite3::SQLException: no such column: count: SELECT COUNT(*) AS count_all, videos.id AS videos_id FROM videos, tags, taggings WHERE (videos.id != 1724 AND videos.id = taggings.taggable_id AND taggings.taggable_type = 'Video' AND taggings.tag_id = tags.id AND tags.name IN ('read')) GROUP BY videos.id ORDER BY count DESC LIMIT 4
====
</div>
<h4>Similar videos:</h4>
<ul class="large-block-grid-4 small-block-grid-2 medium-block-grid-3">
<%= @related.size %>
<% if @related_videos == nil %>
<% @video.find_related_tags.limit(4).each do |video| %>
<li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment