Quick one, but thought I'd ask.
Is there a better way of getting the column values from a model's column than something like this?
Item.count(:all, :group => 'status').reject! { |i, e| i.blank? }.collect { |i,e| i}
Quick one, but thought I'd ask.
Is there a better way of getting the column values from a model's column than something like this?
Item.count(:all, :group => 'status').reject! { |i, e| i.blank? }.collect { |i,e| i}
Is it the same thing as the following code?
Item.count(:all, :group => "status", :conditions => "status != ''"}
.. maybe not ..
but then could you please specify more criteria you want? i.e. status is blank? count is blank?
Item.find(:all, :select=>:status, :group => 'status', :conditions => "status != ''").collect{|r| r.status}