我的Rails应用程序设置为
Devise,但它仍处于开发阶段.我还有一个Thor任务,可以创建默认的Admin用户.
问题是在确认帐户之前,Devise不会让该管理员用户登录该站点.有没有办法可以禁用可确认模块来创建特定用户,例如Admin?
我的托尔任务:
class Setup < Thor desc "create_admin [EMAIL] [PASSWORD]","Creates the administrative user." def create_admin(email = "admin@bogus.com",password = "testpassword123") require File.expand_path('config/environment.rb') # load Rails environment admin = User.create(:email => email,:password => password,:password_confirmation => password) admin.assign_role :admin puts "Admin user (#{ email }) created." end end