We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f126bd commit 0854cbbCopy full SHA for 0854cbb
lib/tasks/admin_generator.rake
@@ -1,8 +1,10 @@
1
# desc "Explaining what the task does"
2
task admin_generator: :environment do
3
app = App.first
4
- app.add_admin(Agent.create(
5
- email: ENV['ADMIN_EMAIL'],
6
- password: ENV['ADMIN_PASSWORD']
7
- ))
8
-end
+ if app.app_users.where(role: "admin", email: ENV['ADMIN_EMAIL']).none?
+ app.add_admin(Agent.create(
+ email: ENV['ADMIN_EMAIL'],
+ password: ENV['ADMIN_PASSWORD']
+ ))
9
+ end
10
+end
0 commit comments