app/controllers/tags_controller.rb
# GET /tags/1
# GET /tags/1.xml
#
# For a given class, get the object instance with the id and then get it's set of tags
#


For a given class, get the object instance with the id and then get it's set of tags
For a given class get the object instance with the id and then get it ' s set of tags
def show
    @className = params[:class]
    @personId = params[:id]
    if isok(@className)
      obj = eval(@className).find(@personId)
      contexts1 = getContexts(@className).sort_by{|name| name.downcase }
      contexts2 = TagContext.all.collect{|v| v.name}
      contexts = contexts1.concat(contexts2).collect{|a| a.downcase }.uniq.sort_by{|name| name.downcase }.collect{|n| n.capitalize}
      @allTags = Hash.new
      contexts.each do |context|
        if getTagOwner
          tags = obj.owner_tag_list_on(getTagOwner, context)
        else  
          tags = obj.tag_list_on( context )
        end
        if tags != nil
          @allTags[context] = tags
        end
      end
    end
  rescue => ex
    render status: :bad_request, text: ex.message
  end
def show @className = params [ :class ] @personId = params [ :id ] if isok ( @className ) obj = eval ( @className ) . find ( @personId ) contexts1 = getContexts ( @className ) . sort_by { | name | name . downcase } contexts2 = TagContext . all . collect { | v | v . name } contexts = contexts1 . concat ( contexts2 ) . collect { | a | a . downcase } . uniq . sort_by { | name | name . downcase } . collect { | n | n . capitalize } @allTags = Hash . new contexts . each do | context | if getTagOwner tags = obj . owner_tag_list_on ( getTagOwner , context ) else tags = obj . tag_list_on ( context ) end if tags != nil @allTags [ context ] = tags end end end rescue => ex render status : :bad_request , text : ex . message end
GET /tags/1
GET /tags/1.xml
GET / tags / 1 GET / tags / 1 . xml
# For each of the possible contexts get the tags... # taggings.tagger_id IS NULl .... need to deal with owner ???? # 1. Get the set of contexts # contexts = TagContext.all # 2. For each context get the tags for thie person and add them to the results