Skip to content

Instantly share code, notes, and snippets.

@soule
Created March 7, 2016 22:14
Show Gist options
  • Save soule/a66f4599e8460393ff42 to your computer and use it in GitHub Desktop.
Save soule/a66f4599e8460393ff42 to your computer and use it in GitHub Desktop.
#this is in {app root}/tbaconnect/loadteams.rb
require './api.rb'
require 'pp'
api = TBA_API.new("frc2876", "scouting", "v2")
@apiteams = api.get_event_teams('2016nhgrs')
@apiteams.each do |team|
newTeam = Team.new();
newTeam.nickname = team["nickname"]
newTeam.save
end
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160217180557) do:
#abbreviated
create_table "teams", force: :cascade do |t|
t.string "nickname"
t.string "location"
t.integer "team_number"
t.string "key"
t.text "images"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "events"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment