Skip to content

Instantly share code, notes, and snippets.

@katieblair
Last active August 29, 2015 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katieblair/856fceb9c789d4f97997 to your computer and use it in GitHub Desktop.
Save katieblair/856fceb9c789d4f97997 to your computer and use it in GitHub Desktop.
require "sinatra"
require "csv"
require "shotgun"
before do
@players = []
CSV.foreach('lackp_starting_rosters.csv', headers: true, header_converters: :symbol) do |row|
@players << {
name: row[0] + ' ' + row[1], position: row[2], team_name: row[3]
}
end
players
end
get '/' do
erb :index
end
get '/teams/:team_name' do
@player = @players.find do |player|
player[:team_name] == params[:team_name]
end
erb :team
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment