ActionController::InvalidAuthenticityToken at /rails/active_storage/direct_uploads ================================================================================== ActionController::InvalidAuthenticityToken > To access an interactive console with this error, point your browser to: /__better_errors actionpack (6.1.3) lib/action_controller/metal/request_forgery_protection.rb, line 211 -------------------------------------------------------------------------------------- ``` ruby 206 def initialize(controller) 207 @controller = controller 208 end 209 210 def handle_unverified_request > 211 raise ActionController::InvalidAuthenticityToken 212 end 213 end 214 end 215 216 private ``` App backtrace ------------- Full backtrace -------------- - actionpack (6.1.3) lib/action_controller/metal/request_forgery_protection.rb:211:in `handle_unverified_request' - actionpack (6.1.3) lib/action_controller/metal/request_forgery_protection.rb:243:in `handle_unverified_request' - devise (4.7.3) lib/devise/controllers/helpers.rb:255:in `handle_unverified_request' - actionpack (6.1.3) lib/action_controller/metal/request_forgery_protection.rb:238:in `verify_authenticity_token' - activesupport (6.1.3) lib/active_support/callbacks.rb:427:in `block in make_lambda' - activesupport (6.1.3) lib/active_support/callbacks.rb:198:in `block (2 levels) in halting' - actionpack (6.1.3) lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>' - activesupport (6.1.3) lib/active_support/callbacks.rb:199:in `block in halting' - activesupport (6.1.3) lib/active_support/callbacks.rb:512:in `block in invoke_before' - activesupport (6.1.3) lib/active_support/callbacks.rb:512:in `invoke_before' - activesupport (6.1.3) lib/active_support/callbacks.rb:115:in `block in run_callbacks' - actiontext (6.1.3) lib/action_text/rendering.rb:20:in `with_renderer' - actiontext (6.1.3) lib/action_text/engine.rb:55:in `block (4 levels) in <class:Engine>' - activesupport (6.1.3) lib/active_support/callbacks.rb:126:in `block in run_callbacks' - activesupport (6.1.3) lib/active_support/callbacks.rb:137:in `run_callbacks' - actionpack (6.1.3) lib/abstract_controller/callbacks.rb:41:in `process_action' - actionpack (6.1.3) lib/action_controller/metal/rescue.rb:22:in `process_action' - actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action' - activesupport (6.1.3) lib/active_support/notifications.rb:203:in `block in instrument' - activesupport (6.1.3) lib/active_support/notifications/instrumenter.rb:24:in `instrument' - activesupport (6.1.3) lib/active_support/notifications.rb:203:in `instrument' - actionpack (6.1.3) lib/action_controller/metal/instrumentation.rb:33:in `process_action' - actionpack (6.1.3) lib/action_controller/metal/params_wrapper.rb:249:in `process_action' - activerecord (6.1.3) lib/active_record/railties/controller_runtime.rb:27:in `process_action' - actionpack (6.1.3) lib/abstract_controller/base.rb:165:in `process' - actionview (6.1.3) lib/action_view/rendering.rb:39:in `process' - actionpack (6.1.3) lib/action_controller/metal.rb:190:in `dispatch' - actionpack (6.1.3) lib/action_controller/metal.rb:254:in `dispatch' - actionpack (6.1.3) lib/action_dispatch/routing/route_set.rb:50:in `dispatch' - actionpack (6.1.3) lib/action_dispatch/routing/route_set.rb:33:in `serve' - actionpack (6.1.3) lib/action_dispatch/journey/router.rb:50:in `block in serve' - actionpack (6.1.3) lib/action_dispatch/journey/router.rb:32:in `serve' - actionpack (6.1.3) lib/action_dispatch/routing/route_set.rb:842:in `call' - warden (1.2.9) lib/warden/manager.rb:36:in `block in call' - warden (1.2.9) lib/warden/manager.rb:34:in `call' - rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call' - rack (2.2.3) lib/rack/etag.rb:27:in `call' - rack (2.2.3) lib/rack/conditional_get.rb:40:in `call' - rack (2.2.3) lib/rack/head.rb:12:in `call' - actionpack (6.1.3) lib/action_dispatch/http/permissions_policy.rb:22:in `call' - actionpack (6.1.3) lib/action_dispatch/http/content_security_policy.rb:18:in `call' - rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context' - rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/cookies.rb:689:in `call' - activerecord (6.1.3) lib/active_record/migration.rb:601:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call' - activesupport (6.1.3) lib/active_support/callbacks.rb:98:in `run_callbacks' - actionpack (6.1.3) lib/action_dispatch/middleware/callbacks.rb:26:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/executor.rb:14:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call' - better_errors (2.9.1) lib/better_errors/middleware.rb:87:in `protected_app_call' - better_errors (2.9.1) lib/better_errors/middleware.rb:82:in `better_errors_call' - better_errors (2.9.1) lib/better_errors/middleware.rb:60:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call' - web-console (4.1.0) lib/web_console/middleware.rb:132:in `call_app' - web-console (4.1.0) lib/web_console/middleware.rb:28:in `block in call' - web-console (4.1.0) lib/web_console/middleware.rb:17:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call' - railties (6.1.3) lib/rails/rack/logger.rb:37:in `call_app' - railties (6.1.3) lib/rails/rack/logger.rb:26:in `block in call' - activesupport (6.1.3) lib/active_support/tagged_logging.rb:99:in `block in tagged' - activesupport (6.1.3) lib/active_support/tagged_logging.rb:37:in `tagged' - activesupport (6.1.3) lib/active_support/tagged_logging.rb:99:in `tagged' - railties (6.1.3) lib/rails/rack/logger.rb:26:in `call' - sprockets-rails (3.2.2) lib/sprockets/rails/quiet_assets.rb:13:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/remote_ip.rb:81:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/request_id.rb:26:in `call' - rack (2.2.3) lib/rack/method_override.rb:24:in `call' - rack (2.2.3) lib/rack/runtime.rb:22:in `call' - activesupport (6.1.3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/executor.rb:14:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/static.rb:24:in `call' - rack (2.2.3) lib/rack/sendfile.rb:110:in `call' - actionpack (6.1.3) lib/action_dispatch/middleware/host_authorization.rb:98:in `call' - webpacker (5.2.1) lib/webpacker/dev_server_proxy.rb:25:in `perform_request' - rack-proxy (0.6.5) lib/rack/proxy.rb:57:in `call' - railties (6.1.3) lib/rails/engine.rb:539:in `call' - puma (5.2.2) lib/puma/configuration.rb:248:in `call' - puma (5.2.2) lib/puma/request.rb:76:in `block in handle_request' - puma (5.2.2) lib/puma/thread_pool.rb:337:in `with_force_shutdown' - puma (5.2.2) lib/puma/request.rb:75:in `handle_request' - puma (5.2.2) lib/puma/server.rb:431:in `process_client' - puma (5.2.2) lib/puma/thread_pool.rb:145:in `block in spawn_thread'
NoMethodError at /comments/12/comments undefined method `comment_url' for #<Comments::CommentsController:0x00000000025e18> Did you mean? comment_comment_url
http://localhost:3000/comments/9/comments
@_params | #<ActionController::Parameters {"authenticity_token"=>"======", "comment"=> #<ActionController::Parameters {"content"=>"nice"} permitted: false>, "commit"=>"Create Comment", "controller"=>"comments/comments", "action"=>"create", "comment_id"=>"10"} permitted: false> @ransack_items | Ransack::Search<class: Item, base: Grouping <combinator: and>> @commentable | #<Comment id: 10, user_id: nil, commentable_type: "Comment", commentable_id: 9, content: nil, created_at: "-0000", updated_at: "20000"> @current_user | #<User id: 1, email: "admin@gmail.com", created_at: "0000", updated_at: "0000-", first_name: "Admin", last_name: "Man", slug: "admin-man"> @comment | #<Comment id: 12, user_id: 1, commentable_type: "Comment", commentable_id: 10, content: "nice", created_at: "-0000", updated_at: "0000"> Request parameters | {"authenticity_token"=>"=====", "comment"=>{"content"=>"nice"}, "commit"=>"Create Comment", "controller"=>"comments/comments", "action"=>"create", "comment_id"=>"10"}
#controllers/items/comments_controller.rb @commentable = Item.friendly.find(params[:item_id]) #routes.rb resources :items do resources :comments, only: %i[new create destroy], module: :items end