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

How to use SUM() in MySQL for calculated values -

loops - Spock: How to use test data with @Stepwise -