Created
May 9, 2013 05:08
-
-
Save dbonates/5545674 to your computer and use it in GitHub Desktop.
Gist JSON response format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "comments": 0, | |
| "comments_url": "https://api.github.com/gists/5526285/comments", | |
| "commits_url": "https://api.github.com/gists/5526285/commits", | |
| "created_at": "2013-05-06T16:38:54Z", | |
| "description": "#126 Populating a Database", | |
| "files": { | |
| "populating_database.rb": { | |
| "content": "# bash\n\ngem install populator\ngem install faker\nrake db:populate\n\n# lib/tasks/populate.rake\n\nnamespace :db do\n desc \"Erase and fill database\"\n task :populate => :environment do\n require 'populator'\n require 'faker'\n \n [Category, Product, Person].each(&:delete_all)\n \n Category.populate 20 do |category|\n category.name = Populator.words(1..3).titleize\n Product.populate 10..100 do |product|\n product.category_id = category.id\n product.name = Populator.words(1..5).titleize\n product.description = Populator.sentences(2..10)\n product.price = [4.99, 19.95, 100]\n product.created_at = 2.years.ago..Time.now\n end\n end\n \n Person.populate 100 do |person|\n person.name = Faker::Name.name\n person.company = Faker::Company.name\n person.email = Faker::Internet.email\n person.phone = Faker::PhoneNumber.phone_number\n person.street = Faker::Address.street_address\n person.city = Faker::Address.city\n person.state = Faker::Address.us_state_abbr\n person.zip = Faker::Address.zip_code\n end\n end\nend", | |
| "filename": "populating_database.rb", | |
| "language": "Ruby", | |
| "raw_url": "https://gist.github.com/raw/5526285/b5bdfcf3d81757e623e32774fa7e0fc6f08cd233/populating_database.rb", | |
| "size": 1121, | |
| "type": "application/ruby" | |
| } | |
| }, | |
| "forks": [ | |
| ], | |
| "forks_url": "https://api.github.com/gists/5526285/forks", | |
| "git_pull_url": "https://gist.github.com/5526285.git", | |
| "git_push_url": "https://gist.github.com/5526285.git", | |
| "history": [ | |
| { | |
| "change_status": { | |
| "additions": 39, | |
| "deletions": 0, | |
| "total": 39 | |
| }, | |
| "committed_at": "2013-05-06T16:38:54Z", | |
| "url": "https://api.github.com/gists/5526285/e853e2226898a46123df5de854d574f42bad5d9d", | |
| "user": { | |
| "avatar_url": "https://secure.gravatar.com/avatar/b4a2c84fca7f29393007f04bfc2b41b8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", | |
| "events_url": "https://api.github.com/users/dbonates/events{/privacy}", | |
| "followers_url": "https://api.github.com/users/dbonates/followers", | |
| "following_url": "https://api.github.com/users/dbonates/following{/other_user}", | |
| "gists_url": "https://api.github.com/users/dbonates/gists{/gist_id}", | |
| "gravatar_id": "b4a2c84fca7f29393007f04bfc2b41b8", | |
| "html_url": "https://github.com/dbonates", | |
| "id": 188093, | |
| "login": "dbonates", | |
| "organizations_url": "https://api.github.com/users/dbonates/orgs", | |
| "received_events_url": "https://api.github.com/users/dbonates/received_events", | |
| "repos_url": "https://api.github.com/users/dbonates/repos", | |
| "starred_url": "https://api.github.com/users/dbonates/starred{/owner}{/repo}", | |
| "subscriptions_url": "https://api.github.com/users/dbonates/subscriptions", | |
| "type": "User", | |
| "url": "https://api.github.com/users/dbonates" | |
| }, | |
| "version": "e853e2226898a46123df5de854d574f42bad5d9d" | |
| } | |
| ], | |
| "html_url": "https://gist.github.com/5526285", | |
| "id": "5526285", | |
| "public": true, | |
| "updated_at": "2013-05-06T16:38:54Z", | |
| "url": "https://api.github.com/gists/5526285", | |
| "user": { | |
| "avatar_url": "https://secure.gravatar.com/avatar/b4a2c84fca7f29393007f04bfc2b41b8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", | |
| "events_url": "https://api.github.com/users/dbonates/events{/privacy}", | |
| "followers_url": "https://api.github.com/users/dbonates/followers", | |
| "following_url": "https://api.github.com/users/dbonates/following{/other_user}", | |
| "gists_url": "https://api.github.com/users/dbonates/gists{/gist_id}", | |
| "gravatar_id": "b4a2c84fca7f29393007f04bfc2b41b8", | |
| "html_url": "https://github.com/dbonates", | |
| "id": 188093, | |
| "login": "dbonates", | |
| "organizations_url": "https://api.github.com/users/dbonates/orgs", | |
| "received_events_url": "https://api.github.com/users/dbonates/received_events", | |
| "repos_url": "https://api.github.com/users/dbonates/repos", | |
| "starred_url": "https://api.github.com/users/dbonates/starred{/owner}{/repo}", | |
| "subscriptions_url": "https://api.github.com/users/dbonates/subscriptions", | |
| "type": "User", | |
| "url": "https://api.github.com/users/dbonates" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment