- me at GitHub: https://github.com/jmosouza
- Make your own gem: http://guides.rubygems.org/make-your-own-gem/
| pg_dump -Fc \ | |
| -d REMOTE_DB_NAME \ | |
| -h REMOTE_DB_HOST \ | |
| -p 5432 \ | |
| -U REMOTE_DB_USER \ | |
| |\ | |
| pg_restore \ | |
| -d LOCAL_DB_NAME \ | |
| -h localhost \ | |
| -p 5432 \ |
| # Pseudo-code to create pairs of people who didn't meet yet. | |
| # In exceptional case, there may be three people in a group. | |
| donuts = [] | |
| people = Person.pluck(:id, :already_met) # { id: 1, already_met: [2, 3, 4] } | |
| for person in people: | |
| # skip if person is already in a donut | |
| next if donuts.flat_map.include(person.id) |