0

捆绑更新后,我无法登录我的 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)
4

1 回答 1

0

I assume that devise configuration is in your ApplicationController. Did you include the before_filter call?

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
于 2013-10-30T09:50:19.913 回答