plataformatec/devise — pull request #3131 by beauby (2014-08-02 19:24:56+00:00)
Title: Fix mapping not set when using devise_scope without devise_for.

This patch fixes https://github.com/plataformatec/devise/issues/2840. When setting solely custom routes with `devise_scope`, `Devise.add_mapping` is never called, thus resulting in
```AbstractController::ActionNotFound:
Could not find devise mapping for path "/users/sign_in".
This may happen for two reasons:

1) You forgot to wrap your route inside the scope block. For example:

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

2) You are testing a Devise controller bypassing the router.
If so, you can explicitly tell Devise which mapping to use:

@request.env["devise.mapping"] = Devise.mappings[:user]
```

This patch adds the mapping inside devise_scope, but only if the mapping is not already set.