our site admin deleted his own id while deleting users ,what can i do now to get back admin user can any one help,its urgent.
create new admin
using rails console create new admin… for instance, if you are having user model having role admin… you can create like
User.create(:email => “admin@admin.com”, :username => “admin”, :password => “12345678”, :password_confirmation => “12345678”, :admin => true)…
I hope this will help
using rails console create new admin… for instance, if you are having user model having role admin… you can create like
User.create(:email => “admin@admin.com”, :username => “admin”, :password => “12345678”, :password_confirmation => “12345678”, :admin => true)…
I hope this will help
ankit c wrote in post #1168678:
using rails console create new admin.. for instance, if you are having user model having role admin.. you can create like User.create(:email => "admin@admin.com", :username => "admin", :password => "12345678", :password_confirmation => "12345678", :admin => true)..
I hope this will help
On Thursday, February 26, 2015 at 12:13:54 PM UTC+5:30, Ruby-Forum.com User
okay thank you ,i will try this.
using rails console create new admin.. for instance, if you are having user model having role admin.. you can create like User.create(:email => "admin@admin.com", :username => "admin", :password => "12345678", :password_confirmation => "12345678", :admin => true)..
The exact details will, of course, depend on exactly what fields you have in your users table. Having done that improve the code so that a user cannot delete either himself or the last admin user.
Colin