find_all_tags_from_host(db_host)click to toggle source
returns an array of hash containing tags of a host
# File lib/puppet/rails/resource_tag.rb, line 19defself.find_all_tags_from_host(db_host)
tags = db_host.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN resources r ON t.resource_id=r.id INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE r.host_id=#{db_host.id}")
tags.eachdo|val|val['resource_id'] = Integer(val['resource_id'])
endtagsend
find_all_tags_from_resource(db_resource)click to toggle source
returns an array of hash containing tags of resource
# File lib/puppet/rails/resource_tag.rb, line 10defself.find_all_tags_from_resource(db_resource)
tags = db_resource.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE t.resource_id=#{db_resource.id}")
tags.eachdo|val|val['resource_id'] = Integer(val['resource_id'])
endtagsend
Public Instance Methods
to_label()click to toggle source
# File lib/puppet/rails/resource_tag.rb, line 5defto_label"#{self.puppet_tag.name}"end