Skip to content

Commit

Permalink
Merge pull request spree#752 from LBRapid/db-admin-create-fix
Browse files Browse the repository at this point in the history
Prompt for creation of user during rake db:admin:create
  • Loading branch information
Trung Lê committed Nov 12, 2011
2 parents 75392e4 + cca8e6b commit 803024a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion auth/db/default/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,16 @@ def create_admin_user
end

if Rails.env.development?
create_admin_user if Spree::User.where("#{Spree::Role.table_name}.name" => "admin").includes(:roles).empty?
if User.where("roles.name" => 'admin').includes(:roles).empty?
create_admin_user
else
puts "Admin user has already been previsouly created."
puts "Would you like to create a new admin user?"
res = STDIN.gets.chomp
if res =~ /y[es]*/
create_admin_user
else
puts "No admin user created."
end
end
end

0 comments on commit 803024a

Please sign in to comment.