Skip to content

Instantly share code, notes, and snippets.

@Ravenclaw968
Created July 14, 2017 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ravenclaw968/65681f48eeb929b125d0ca980a74d345 to your computer and use it in GitHub Desktop.
Save Ravenclaw968/65681f48eeb929b125d0ca980a74d345 to your computer and use it in GitHub Desktop.
Competition.joins("LEFT JOIN keywords_and_users ON keywords_and_users.user_id = #{session[:user_id]}").where(id: CompetitionsAndKeyword.where(keyword_id: KeywordsAndUser.where(user_id: session[:user_id]).pluck(:keyword_id)).pluck(:competition_id)).order("(interested / views) * keywords_and_users.score DESC")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment