a guest Mar 13th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- ## TODO: There has *got* to be another way to do this. It's ridiculous.
- def all_by_tags some_tags
- query = 
- some_tags.each do |tag|
- query << 'SELECT taggings.post_id FROM tags LEFT JOIN taggings ON tags.id = taggings.tag_id WHERE tags.name = ?'
- post_ids = database.query([query.join(" UNION "), some_tags].flatten)
RAW Paste Data