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) end end images found under tag <%= @tag.name %>