[openstreetmap/openstreetmap-website] DB seed script (PR #6432)

Pablo Brasero notifications at github.com
Wed Feb 11 10:01:40 UTC 2026


@pablobm commented on this pull request.

Addressed the comments now 👍 

> +
+def create_user(display_name:, password:, email:, admin: false)
+  user = User.find_or_create_by!(:display_name => display_name) do |record|
+    record.email = email
+    record.pass_crypt = password
+    record.pass_crypt_confirmation = password
+    record.tou_agreed = Time.now.utc
+    record.terms_seen = true
+    record.terms_agreed = Time.now.utc
+    record.email_valid = true
+    record.data_public = true
+  end
+
+  unless user.confirmed?
+    user.activate!
+    user.confirm!

Ah, I must have copied this from https://gist.github.com/mmd-osm/a3a0b5a8799a333e7fae578038aa7a93. Removing 👍 

> +  puts(
+    <<~MESSAGE
+      #{initial_line}:
+        - Display name: #{display_name}
+        - Email: #{email}
+        - Password: #{password}
+    MESSAGE
+  )
+end
+
+namespace "dev" do
+  desc "Populate the development database with some fake data"
+  task "populate" => :environment do
+    raise "This task can only be run in development mode" unless Rails.env.development?
+
+    require "active_support/testing/time_helpers"

Touche 😅 Moved to the top.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6432#pullrequestreview-3780052073
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6432/review/3780052073 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260211/0e14d88d/attachment.htm>


More information about the rails-dev mailing list