Skip to content

Instantly share code, notes, and snippets.

@urbanczykd
Created January 30, 2015 15:17
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 urbanczykd/389bcca93aeb568e9ae0 to your computer and use it in GitHub Desktop.
Save urbanczykd/389bcca93aeb568e9ae0 to your computer and use it in GitHub Desktop.
named_scope :answered, :conditions => {:disposition => 1}
named_scope :missed, :conditions => {:disposition => 2}
Call.answered.count
=> 390357
>> Call.missed.count
=> 48029
>> Call.answered.missed.count
=> 48029
SELECT count(*) AS count_all FROM `phone_call` WHERE (`phone_call`.`disposition` = 1)
SELECT count(*) AS count_all FROM `phone_call` WHERE (`phone_call`.`disposition` = 2)
SELECT count(*) AS count_all FROM `phone_call` WHERE ((`phone_call`.`disposition` = 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment