Skip to content

Instantly share code, notes, and snippets.

@reagent
Created May 2, 2012 18:42
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 reagent/2579088 to your computer and use it in GitHub Desktop.
Save reagent/2579088 to your computer and use it in GitHub Desktop.
class Family < ActiveRecord::Base
def self.with_discontinued_accessories
joins(:products).where({
:products => {
:accessory => true,
:production_status => 'discontinued',
:active => true,
:parent_id => nil
}
}).uniq
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment