Plugins - scalable acts as taggable
Add to favoritesRepeated DB entries are no longer taking place. If “atag” is added three times then “atag” gets count=3 in the DB instead of three separate entries. Also, add_tag(‘one two’) is added to the methods so that you can just add a tag or two or three. All words are now separated by ”,” or ” ”.
./script/plugin install svn://rubyforge.org/var/svn/scalabletagging/vendor/plugins/scalable_acts_as_taggable
see for db and setup details
http://rubyforge.org/projects/scalabletagging/
Project sponsored by
http://www.zivity.com
http://rubyforge.org/projects/scalabletagging/
svn://rubyforge.org/var/svn/scalabletagging/vendor/plugins/scalable_acts_as_taggable
Rails' (MIT)
Misc. Enhancements

thanks somaking. that did it.
>> p = Photoset.find(2) => #<Photoset id: 2, photographerid: 7, name: "Classic", createdat: "2007-10-15 18:10:28", updatedat: "2007-12-28 17:08:08", status: "Published", photographerlicenseid: 0, processing: false, failedprocessingattempts: 0, photoshootid: 2, description: "", published_at: "2007-10-15 18:10:28"> >> p.tag_counts => [] >> p.add_tag('blue baby') => ["blue", "baby"] >> p.tag_counts => [#<Tag id: 3, name: "blue", count: 1>, #<Tag id: 2, name: "baby", count: 1>] >> p = Photoset.find(3) => #<Photoset id: 3, photographerid: 11, name: nil, createdat: "2007-10-15 20:08:51", updatedat: "2007-12-28 17:08:08", status: "Uploaded", photographerlicenseid: 0, processing: false, failedprocessingattempts: 0, photoshootid: 3, description: nil, published_at: "2007-10-15 20:08:51"> >> p.add_tag('baby back') => ["baby", "back"] >> p.tag_counts => [#<Tag id: 2, name: "baby", count: 1>, #<Tag id: 4, name: "back", count: 1>] >>
There's some bugs in this code. I have spent way too much time on something that should work out of the box.
One problem I have discovered is you can't assign a tag to more than one object. The bug is in tagging.rb.
This line: taggable = Tagging.find(:first, :conditions => ['tagid = ? AND taggabletype = ?', existingtag.id, self.taggabletype])
should be this line: taggable = Tagging.find(:first, :conditions => ['tagid = ? AND taggabletype = ? AND taggableid = ?', existingtag.id, self.taggabletype, self.taggableid])
I think. Its hard to know exactly. What I do know is the code doesn't work properly.
hey michael, can you be more specific? btw. you can catch me on aim all the time. my aim is lemynshij
I am having the same problem as Brian. I have the latest version, but I can't use a tag for multiple objects.
Brian. that's right. each word is parsed and lowercased. except for "quoted phrases". check out http://www.google.com/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fwww.beautifulsimplethings.com%2F2007%2F6%2F14%2Fusing-scalable-acts-as-taggable&ei=QNizRpGOEaPihQOP6ngBA&usg=AFQjCNFmgc9vqkCCYE6bV6GgCkjZxP6Now&sig2=jKfz10OUAXbfyvqS64rCQ
for usage details. hope this helps. thanks for the feedback.
Just downloaded the latest version...I think it's a great idea and I could be using this incorrectly, but the plugin doesn't seem to want to relate more than one record for each tag. I didn't have any problems using actsas_taggableon_steroids...
Thanks for the feedback. I've fixed this bug, and made testing work.. and added testing for this particular bug fix. I hadn't used the plugin for more than one class... and all of actsas_taggableon_steroids testing was broken after my changes to it. So fixing those was a pain. But its done. So here it is again, with proper functionalality and more testing.
Ron, I'm pretty sure that the new line
should suffice. Adding the tagging_id wouldn't make sense since that is what i'm trying to find.
Soph, you are correct about before_create. I played around with it, and the basic idea of incrementing the count of the taggings instead of just adding another tagging is good. The problem was that the author did not implement it correctly. Here is what I think he originally intended:
def before_create tagging = Tagging.findby_tagidandtaggableid_andtaggabletype(self.tagid, self.taggableid, self.taggabletype) if tagging tagging.updateattributes(:count => (tagging.count.toi + 1) ) return false else return true end end
The problem is the "before_create" method in Tagging:
def before_create existingtag = Tag.find(self.tagid) if existing_tag taggable = Tagging.findby_tagid(existing_tag.id) if taggable taggable.updateattributes(:count => (taggable.count.toi + 1) ) return false end end return true end
It looks for any Tagging with the same Tag.id and then doesn't inserts a new Relation. This is a huge bug, since Tagging is the relation between a taggable an a tag, but everytime ANY taggable uses the same tag the first Tagging Relation gets a count update and the new Tagging Relation isn't inserted.
Great Work, i had other issues too and after i found this problem i removed scalableactastaggable and switch to actsastaggableon_steroids.
I'm not sure what this actually buys. I had the actsas_taggableon_steroids already installed.
By installing this, I was unable to add tags to other items. For some reason, it has a "count" function on the "taggings" column. I'm not sure that makes much sense. When I try to add a tag to additional items, it increases the tagging count.
Maybe I have something set up incorrectly... but it looks like its functioning as designed. Look at the "before create" function on tagging.rb. Its not looking to see if the tagging is for an different item (Post 1 vs Post 3 for example)