Welcome Guest, Not a member yet? Register   Sign In
Quick question regarding where_in/where_not_in Active Record
#6

[eluser]Darwin Survivor[/eluser]
Actually, I'm set up a little differently.

My tags table is equivalent to what you are calling trans_table. I know it's probably not the most space efficient, but my tag table actually has the image_id and the actual tag (varchar). I am allowing the user to type in ANY tag, not just select from pre-defined ones.

You example, while nice, kind of did the opposite of what I'm looking for. I don't need to know which tags apply to a specific image, but which images have a specific tag (or set of tags) applied to it.

Sorry if my first post was a little confusion, but basically the user is selecting a list of tags (ex: cat, dog, Christmas) and the site shows them all the pictures that have been tagged with any of those tags (ex: pictures of cats, dog, Christmas or any combination of them).

Currently I have the query hard-codded, using a join to create the section after 'IN', but I would like to use active directory to make the code a little easier to read and understand.


Messages In This Thread
Quick question regarding where_in/where_not_in Active Record - by El Forum - 04-19-2009, 05:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB