Skip to content

Commit

Permalink
fix admin_generator rake task to avoid duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
crohr committed May 21, 2020
1 parent 7f126bd commit 0854cbb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/tasks/admin_generator.rake
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# desc "Explaining what the task does"
task admin_generator: :environment do
app = App.first
app.add_admin(Agent.create(
email: ENV['ADMIN_EMAIL'],
password: ENV['ADMIN_PASSWORD']
))
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']
))
end
end

0 comments on commit 0854cbb

Please sign in to comment.