私はdevise_token_authを使用して、ユーザーのsign_in URLを変更しようとしています。私が望むように私はrake routes
は私がルートを取得しないときdevise_token_authのURLを変更するsign_in
namespace :api do
namespace :v2 do
mount_devise_token_auth_for 'User', at: 'users', :controllers => {
:registrations => 'api/v2/registrations',
:confirmations => 'api/v2/confirmations',
:passwords => 'api/v2/passwords',
:sessions => 'api/v2/sessions'}
post 'users/sign-in', to: 'sessions#create'
end
end
:
ルート:私は以下のように私のapi/v2/
フォルダとdevise_token_authルートでsessions_controllerを持って
api_v2_users_sign_in POST /api/v2/users/sign-in(.:format) api/v2/sessions#create
でも、私がヒットしようとすると私はapi/v2/users/sign-in
するURLが必要
AbstractController::ActionNotFound (Could not find devise mapping for path "/api/v2/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]
):
/Users/gokul/.rvm/gems/[email protected]/bundler/gems/devise-bcdd54cc5ebd/app/controllers/devise_controller.rb:88:in `unknown_action!'
/Users/gokul/.rvm/gems/[email protected]/bundler/gems/devise-bcdd54cc5ebd/app/controllers/devise_controller.rb:63:in `assert_is_devise_resource!'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:382:in `block in make_lambda'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
actionpack (5.0.0.rc1) lib/abstract_controller/callbacks.rb:12:in `block (2 levels) in <module:Callbacks>'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:170:in `block in halting'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:454:in `block in call'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:454:in `each'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:454:in `call'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.rc1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.0.rc1) lib/action_controller/metal/rescue.rb:31:in `process_action'
actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.0.rc1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.0.rc1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.0.rc1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.0.rc1) lib/abstract_controller/base.rb:126:in `process'
actionpack (5.0.0.rc1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.0.rc1) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:725:in `call'
apipie-rails (0.3.6) lib/apipie/static_dispatcher.rb:65:in `call'
actionview (5.0.0.rc1) lib/action_view/digestor.rb:12:in `call'
apipie-rails (0.3.6) lib/apipie/extractor/recorder.rb:132:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.0.rc1) lib/rack/etag.rb:25:in `call'
rack (2.0.0.rc1) lib/rack/conditional_get.rb:38:in `call'
rack (2.0.0.rc1) lib/rack/head.rb:12:in `call'
activerecord (5.0.0.rc1) lib/active_record/migration.rb:552:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.rc1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.rc1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.rc1) lib/rails/rack/logger.rb:24:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.0.rc1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.rc1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.rc1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.0.rc1) lib/rack/sendfile.rb:111:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
railties (5.0.0.rc1) lib/rails/engine.rb:522:in `call'
puma (3.2.0) lib/puma/configuration.rb:227:in `call'
puma (3.2.0) lib/puma/server.rb:561:in `handle_request'
puma (3.2.0) lib/puma/server.rb:406:in `process_client'
puma (3.2.0) lib/puma/server.rb:271:in `block in run'
puma (3.2.0) lib/puma/thread_pool.rb:111:in `block in spawn_thread'
:電子のURLは、私は次のエラーが発生します。私を助けてください。
おかげ..