daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 51 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. ## TODO: There has *got* to be another way to do this. It's ridiculous.
  2.   def all_by_tags some_tags
  3.     query = []
  4.     some_tags.each do |tag|
  5.       query << 'SELECT taggings.post_id FROM tags LEFT JOIN taggings ON tags.id = taggings.tag_id WHERE tags.name = ?'
  6.     end
  7.  
  8.     post_ids = database.query([query.join(" UNION "), some_tags].flatten)
  9.     Post.all(post_ids)
  10.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top