Unexpected 'ArgumentError' when using custom middleware for request logging in Rails 7.0
I'm trying to configure I'm implementing a custom middleware in my Rails 7.0 application to log incoming requests, but I'm working with an `ArgumentError` when it tries to access the request parameters... My middleware looks like this: ```ruby class RequestLoggerMiddleware def initialize(app) @app = app end def call(env) request = Rack::Request.new(env) Rails.logger.info "Request: #{request.request_method} #{request.path} #{request.params.inspect}" @app.call(env) end end ``` I added this middleware to my `application.rb` like so: ```ruby config.middleware.use RequestLoggerMiddleware ``` However, I'm getting the following behavior when I make a request: ``` ArgumentError: wrong number of arguments (given 0, expected 1) ``` It seems to be related to how Iβm instantiating or calling something, but I need to figure out whatβs wrong. Iβve tried debugging the middleware by using `puts` statements to track where the behavior occurs, and it seems to arise right when I'm trying to access `request.params`. I've also confirmed that other middleware is working correctly, so it seems isolated to this custom implementation. I've looked at the documentation for middleware and Rack, but I haven't found anything that addresses this scenario directly. Can anyone help pinpoint what might be causing this behavior and how to resolve it? Thanks, I really appreciate it!