简体   繁体   中英

i dont understand how the devise admin model work

I am building a rails app, and i want users and a Admin (me), but i dont understand how the devise admin model work, because if i have have a admin model, cant anyone just go to the link (/admins/sign_up) and sign_up as a admin on my site?

I have already tried to look around on the internet but i just cant seem to find an answer.

If you can explain to me how i can get over this problem, i would love you :D

Thank you - Peace

If you run rake routes | grep 'admin' rake routes | grep 'admin' you will see that there is no route like admin/sign_up. The admin user should be created on rails console or within the admin.

When you install devise (with the migrations and all) it creates for you a default admin user with email: "admin@example.com" and password: "password".

You should login with it to create your real admin user and them delete this default one.

And here is an excellent devise tutorial: http://www.gotealeaf.com/blog/how-to-use-devise-in-rails-for-authentication :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM