lib/tasks/admin_user.rake in gaku_admin-0.2.2 vs lib/tasks/admin_user.rake in gaku_admin-0.2.3
- old
+ new
@@ -89,13 +89,14 @@
say "\nWARNING: There is already a user with the email: #{email}, so no account changes were made. If you wish to create an additional admin user, please run rake gaku:generate_admin again with a different email.\n\n"
elsif Gaku::User.find_by_username(username)
say "\nWARNING: There is already a user with the username: #{username}, so no account changes were made. If you wish to create an additional admin user, please run rake gaku:generate_admin again with a different username.\n\n"
else
say "Creating user..."
- creator = Gaku::UserCreator.new(attributes).save
+ creator = Gaku::UserCreator.new(attributes)
+ creator.save
admin = creator.get_user
# create an admin role and and assign the admin user to that role
- role = Gaku::Role.find_or_create_by_name 'Admin'
+ role = Gaku::Role.where(name: 'Admin').first_or_initialize
admin.roles << role
if admin.save
say "User Created"
else
say "User NOT Created"