Commit 0557b003be4250b73e0970d9e81bda8edbef22be
Exists in
master
and in
1 other branch
Merge pull request #881 from stevecrozz/db_seeds_idempotency
refs #880 let db:seed be idempotent
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
db/seeds.rb
1 | 1 | require 'securerandom' |
2 | +require 'pry' | |
2 | 3 | |
3 | 4 | puts "Seeding database" |
4 | 5 | puts "-------------------------------" |
... | ... | @@ -14,13 +15,12 @@ puts "-- email: #{admin_email}" |
14 | 15 | puts "-- password: #{admin_pass}" |
15 | 16 | puts "" |
16 | 17 | puts "Be sure to note down these credentials now!" |
17 | -user = User.find_or_initialize_by(:email => admin_email) do |u| | |
18 | - u.name = 'Errbit Admin' | |
19 | - u.password = admin_pass | |
20 | - u.password_confirmation = admin_pass | |
21 | -end | |
22 | -user.username = admin_username if Errbit::Config.user_has_username | |
23 | 18 | |
19 | +user = User.find_or_initialize_by(:email => admin_email) | |
20 | + | |
21 | +user.name = 'Errbit Admin' | |
22 | +user.password = admin_pass | |
23 | +user.password_confirmation = admin_pass | |
24 | +user.username = admin_username if Errbit::Config.user_has_username | |
24 | 25 | user.admin = true |
25 | 26 | user.save! |
26 | - | ... | ... |