Guest User

Untitled

a guest
Aug 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Rails how to count columns that are not blank?
  2. def sedomain
  3. country_codes = %w[ dk se com net org info ]
  4. @domains = { }
  5. country_codes.each do |cc|
  6. @domains[cc.to_sym] = { :navn => ".#{cc}" }
  7. end
  8. render :layout => 'page'
  9. end
  10.  
  11. def sedomain
  12. country_codes = %w[ dk se com net org info ]
  13. @domains = { }
  14. country_codes.each do |cc|
  15. @domains[cc.to_sym] = { :navn => ".#{cc}", :count => Domain.#{cc}.count }
  16. end
  17. render :layout => 'page'
  18. end
  19.  
  20. Domain.count(cc)
  21.  
  22. Domain.count(cc, :conditions => ["`#{cc}` IN NOT NULL OR `#{cc}` != ''"])
Add Comment
Please, Sign In to add comment