Could not find devise mapping for path “/sessions/user” devise log in error

前端 未结 5 2003
名媛妹妹
名媛妹妹 2021-02-19 04:43

Very frustrating for the last few days.

I have a rails app with Devise installed where I generated a new User model and I generated Devise views as well.

This h

5条回答
  •  灰色年华
    2021-02-19 05:09

    This error (AbstractController::ActionNotFound - Could not find devise mapping for path) can arise if devise_scope is passed a plural scope instead of a singular scope.

    The devise_for method takes a plural form of model scope (i.e. :users) whereas the devise_scope takes the singular form (i.e. :user).

    From the devise documentations (http://www.rubydoc.info/github/plataformatec/devise/ActionDispatch%2FRouting%2FMapper%3Adevise_scope):

    Also be aware of that 'devise_scope' and 'as' use the singular form of the noun where other devise route commands expect the plural form. This would be a good and working example.

    devise_scope :user do
      get "/some/route" => "some_devise_controller"
    end
    devise_for :users
    

提交回复
热议问题