module Export::Teams::Team

Public Class Methods

export() click to toggle source
# File app/models/export/teams.rb, line 5
def Team.export
  Team.export_head
  Team.export_data
end
export_columns() click to toggle source
# File app/models/export/teams.rb, line 34
def Team.export_columns
  [
    "id", "name", "city", "state", "website", "contact_name", "contact_email", "contact_phone"
  ]
end
export_data() click to toggle source
# File app/models/export/teams.rb, line 16
def Team.export_data
  Base.export(Team.export_data_sql, "teams.csv")
end
export_data_sql() click to toggle source
# File app/models/export/teams.rb, line 26
def Team.export_data_sql
  "SELECT #{Team.export_columns.join(",")}
   INTO OUTFILE '%s'
   FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
   LINES TERMINATED BY '\\n'
   FROM teams"
end
export_head() click to toggle source
# File app/models/export/teams.rb, line 12
def Team.export_head
  Base.export(Team.export_head_sql, "teams.txt")
end
export_head_sql() click to toggle source
# File app/models/export/teams.rb, line 20
def Team.export_head_sql
  "SELECT '#{Team.export_columns.join("','")}'
   INTO OUTFILE '%s'
   FIELDS TERMINATED BY '\\n'"
end