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 -

ios - IBOutlet for image button not correctly referencing button after recreating outlet -

java - AEM: 403 Forbidden occurs when call a Post servlet -