[openstreetmap/openstreetmap-website] Create a dev:populate task to add fake data to your dev environment (#3101)

Andy Allan notifications at github.com
Wed Feb 17 14:47:20 UTC 2021

This is an alternative approach to #3030 with the same overall goal. It's based on the approach that I outlined there, namely being idempotent, and using Faker and FactoryBot to cut down on the code required, and being a separate task so that there's no overlap between (expected) seed data and (optional) dev data.

@tordans what do you think? If you have the chance to try this out, and see if it would work as the basis for what you were trying to do, that would be great. 

At the moment it only creates one user and one diary entry, since it was piecing together the FactoryBot strategy along with the steps to achieve idempotency that was the bulk of the work in this PR. I'm hoping that it's straightforward to expand to more data.
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * Implement a rake task to generate fake data for development purposes
  * Add a diary entry, as an example
  * Include factorybot syntax, for less typing
  * Ensure the find_or_create strategy is only available in the development environment
  * Add some more detailed comments

-- File Changes --

    M Gemfile (4)
    M Gemfile.lock (7)
    A config/initializers/factory_bot_strategy_find_or_create.rb (33)
    A lib/tasks/development.rake (28)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210217/bde9ab3d/attachment.htm>

More information about the rails-dev mailing list