class TagsController < ApplicationController layout 'standard' tagging_controller_helpers def show query = 'select b.tag_id, a.id, a.title from yourimages a, taggings b, tags c where c.id = b.tag_id and b.taggable_id = a.id order by b.tag_id asc;' @yourimages = Yourimage.find_by_sql(query) endendimages found under tag <strong><%= @tag.name %></strong><ul id="imagelist"><% @yourimages.each do |c| %> <% if c.tag_id.to_i == @tag.id.to_i %> <li> <%= link_to c.title.downcase, {:controller => 'yourimage', :action => 'show', :id => c.id} -%></li> <% end %><% end %></ul>