Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Output =
- CSV.generate do |builder|
- builder << [
- 'Company ID',
- 'Company Name',
- 'Appears on their w4 form'
- ]
- companies = Company.active
- companies.each do |company|
- if company.masteruser.present? && company.masteruser.name.present?
- companies_w4 = []
- companies_w4 << company.id
- companies_w4 << company.try(:name)
- companies_w4 << company.try(:masteruser).try(:name)
- builder << companies_w4
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement