Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. Output =
  2. CSV.generate do |builder|
  3. builder << [
  4. 'Company ID',
  5. 'Company Name',
  6. 'Appears on their w4 form'
  7. ]
  8. companies = Company.active
  9. companies.each do |company|
  10. if company.masteruser.present? && company.masteruser.name.present?
  11. companies_w4 = []
  12. companies_w4 << company.id
  13. companies_w4 << company.try(:name)
  14. companies_w4 << company.try(:masteruser).try(:name)
  15. builder << companies_w4
  16. end
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement