A few days I linked to Dema’s tagging mixin for Rails. In, well, about half an hour over the past two days I implemented it into a project I was working on – first into the models, then into visualisation. The interface will come last (though of course, that doesn’t mean it’s not getting a lot of thought right now).

One problem I ran into was that whilst I could tag away with new tags, adding an already-extant tag to a data object didn’t work – it threw an exception error. In the end, I found this was down to my join table – the tags_things table that assigns tags to thing objects. The thing was, as with most of my tables, I stuck an auto-incrementing id column into it. This was really a stupid idea and not in any way necessary (though in all the other tables, it is fairly appropriate). The moment I just left it with two columns, tag_id and thing_id, it all worked fine.

It’s a nice mixin, by the way – makes searching by tag dead easy and it’s fairly lean. Saved me reinventing the wheel, that’s for sure.