sjtipton/pro_football_api — pull request #3 by sjtipton (2012-04-19 02:53:22+00:00)
Title: Schedule JSON and rake tasks

This changeset implements a rake task to update each Game with `:week` and `:played_at` attribute values.

It may be important to update each development environment with the following, as some data has been corrected in the text file that generates the JSON file:

```ruby
# Open a Rails Console session
rails console

# Delete all existing Games and reset sequences
Game.delete_all
ActiveRecord::Base.connection.reset_pk_sequence!('games')

# Close the console session and return to the command line to run both rake tasks
bundle exec rake db:game:build_all_matchups
bundle exec rake db:game:update_matchups_with_dates_and_times
```

Please review the text file to verify validity with the official schedule located [here](http://www.nfl.com/schedules/print?season=2012&seasonType=REG), and make any adjustments necessary. Any necessary adjustments will require a re-generation of the JSON file and re-run of the above code steps.

You may re-generate the JSON file as follows:

```ruby
# Open interactive editor within a Rails Console session and set the data hash in the text file to a `@data` instance variable, then write and quit

# Generate the JSON file
file = File.open("#{Rails.root}/lib/tasks/schedule_dates_and_times.json", "w")
file.write @data.to_json
file.close
```