Browse Source

Add admin boolean to users and default it to false

Chris Oliver 7 years ago
parent
commit
dcaa797f0b
1 changed files with 8 additions and 1 deletions
  1. 8 1
      template.rb

+ 8 - 1
template.rb

@@ -21,7 +21,14 @@ def add_users
   generate :devise, "User",
            "first_name",
            "last_name",
-           "announcements_last_read_at:datetime"
+           "announcements_last_read_at:datetime",
+           "admin:boolean"
+
+  # Set admin default to false
+  in_root do
+    migration = Dir.glob("db/migrate/*").max_by{ |f| File.mtime(f) }
+    gsub_file migration, /:admin/, ":admin, default: false"
+  end
 end
 
 def add_bootstrap