Skip to content

Instantly share code, notes, and snippets.

@haosu
Created May 14, 2014 23:59
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 haosu/bd561629369ca5d13f5b to your computer and use it in GitHub Desktop.
Save haosu/bd561629369ca5d13f5b to your computer and use it in GitHub Desktop.
scope :untaken, lambda do |profile|
joins(<<-SQL).where('action_credits.id is null')
LEFT OUTER JOIN action_credits ON
actions.id = action_credits.action_id
AND action_credits.profile_id =
#{profile.id}
SQL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment