you could try a where scope...
return 'N/A' if reviews.where('rating IS NOT NULL').size == 0
sum = reviews.reload.where('rating IS NOT NULL').inject(0) {|m, r| m + r.rating }
(sum.to_f / reviews.where('rating IS NOT NULL').size.to_f).round(1)