Jimothy
Placeholder user data from The Office. Gem available at https://rubygems.org/gems/jimothy

What This Does
Quickly seed placeholder user data for your Rails toy app or prototype app. Generate the names, emails and profile pictures of eighteen characters from The Office.
Why
This is a (much) less robust version of something like Faker (https://github.com/faker-ruby/faker). But I built it to be more reliable than Faker, with more solid data. Faker is great for what it does, but if you generate users from TV data for example, sometimes users get weird names like "Skinny Pete", where "Pete" isn't really a last name and it can mess up your data. Yeah it's just placeholder data, but we want it to look right.
Usage (Quick, Using Custom Generator)
- (If you don't have an app already) Run
rails new testapp - Do
cd testapp - Add
gem "jimothy"to yourGemfile - Run
bundle install - Run
rails g jimothy:install - This will scaffold user model/views, import images, seed users and add an image tag to the user view's
_user.html.erbpartial. - Run
rails serverand openhttp://127.0.0.1:3000/users- you should see the users from The Office.

Usage (Slow, Doing Everything By Hand)
- (If you don't have an app already) Run
rails new testapp - Do
cd testapp - Add
gem "jimothy"to yourGemfile - Run
bundle install - You'll need a
Usermodel withname,emailandimagefields (allstrings). Fastest way to do this is:rails generate scaffold User name:string email:string image:string rails db:migrate - Add the following to your
db/seeds.rbfile:require "jimothy" Jimothy::seed_users - Run
rails db:seed - In
app/views/users/_user.html.erb, change<%= user.image %>to<%= image_tag user.image %> - Run
rails serverand go tohttp://127.0.0.1:3000/users- you should see the users from The Office.
Details
- Main methods (
seed_users, etc) are inlib/jimothy.rb - Initial user data is in a json file in
lib/jimothy/the-office-characters.json - Inital user images are in
lib/jimothy/images - I believe images in Rails engines are supposed to be directly available from the gem for use in a Rail app's asset pipeline, but I could not get this working and couldn't find sufficient documentation for this. So I just copy the images from the gem to the rails app (to
app/assets/images) in theimport_imagesmethod, which is called by theseed_usersmethod.