ruby on rails - Count where is not null -


for use

appointment.where.not(time: nil).count 

is possible via appointment.count?

if want achieve using .count you'll have load objects database use ruby count. (from docs: http://edgeapi.rubyonrails.org/classes/activerecord/associations/collectionproxy.html#method-i-count)

so right way have. builds query count objects time column not null.

why change that?


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -