宝石更新后无法登录Activeadmin

时间:2013-10-30 09:40:12

标签: ruby-on-rails devise activeadmin

捆绑更新后,我无法登录到我的Activeadmin,这是日志。 是因为不允许的参数吗?我是否需要配置强参数才能使管理员登录工作?我已经有了这个设计代码:

        def configure_permitted_parameters
          devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password, :remember_me) }
          devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password) }
        end



          Started POST "/admin/login" for 127.0.0.1 at 2013-10-30 22:33:25 +1300
        Processing by ActiveAdmin::Devise::SessionsController#create as HTML
          Parameters: {"utf8"=>"✓", "authenticity_token"=>"MhoM/R/oVfad/iiov2zpqfoJ5XOSLda6rTl/V2cMIZE=", "admin_user"=>{"email"=>"tester@iv.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"}
        Completed 401 Unauthorized in 0.6ms
        Processing by ActiveAdmin::Devise::SessionsController#new as HTML
          Parameters: {"utf8"=>"✓", "authenticity_token"=>"MhoM/R/oVfad/iiov2zpqfoJ5XOSLda6rTl/V2cMIZE=", "admin_user"=>{"email"=>"tester@iv.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"}
        Unpermitted parameters: email, password, remember_me
          Rendered /home/jcui/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.6.2/app/views/active_admin/devise/shared/_links.erb (0.6ms)
          Rendered /home/jcui/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.6.2/app/views/active_admin/devise/sessions/new.html.erb within layouts/active_admin_logged_out (118.2ms)
        Completed 200 OK in 130.7ms (Views: 129.9ms | ActiveRecord: 0.0ms | Solr: 0.0ms)

1 个答案:

答案 0 :(得分:0)

我认为设计配置在ApplicationController中。您是否加入了before_filter来电?

before_filter :configure_permitted_parameters, if: :devise_controller?

def configure_permitted_parameters
  devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:email, :password, :remember_me) }
  devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password) }
end