Skip to content

Rails 8.1 Compatibility Issues: "NoMethodError: undefined method 'sql_runtime' for module ActiveRecord::RuntimeRegistry" #69

@brandon-carag

Description

@brandon-carag

I'm running Ruby 3.4, Rails 8.1.1, and Mysql 8. When I attempt to run any arbitrary query like the following:

  MyModel.
  where("created_at > '#{Date.current.to_fs(:iso)}'").
  count

I receive the following error "NoMethodError: undefined method 'sql_runtime' for module ActiveRecord::RuntimeRegistry"

Please see the stack trace below for more details.

Thanks!

{:"v1/my_endpoint","action":"index","backtrace":[{"number":"24","file":"[GEM_ROOT]/gems/lograge-sql-2.6.0/lib/lograge/active_record_log_subscriber.rb","method":"Lograge::ActiveRecordLogSubscriber#increase_runtime_duration","source":{"22":"      return if Rails.application.config.lograge_sql.keep_default_active_record_log\n","23":"\n","24":"      ActiveRecord::RuntimeRegistry.sql_runtime ||= 0.0\n","25":"      ActiveRecord::RuntimeRegistry.sql_runtime += event.duration\n","26":"    end\n"}},{"number":"9","file":"[GEM_ROOT]/gems/lograge-sql-2.6.0/lib/lograge/active_record_log_subscriber.rb","method":"Lograge::ActiveRecordLogSubscriber#sql","source":{"7":"    # They'll later be accessed from the RequestLogSubscriber.\n","8":"    def sql(event)\n","9":"      increase_runtime_duration(event)\n","10":"      return unless valid?(event)\n","11":"\n"}},{"number":"138","file":"[GEM_ROOT]/gems/activesupport-8.1.1/lib/active_support/subscriber.rb","method":"ActiveSupport::Subscriber#call","source":{"136":"    def call(event)\n","137":"      method = event.name[0, event.name.index(\".\")]\n","138":"      send(method, event)\n","139":"    end\n","140":"  end\n"}},{"number":"147","file":"[GEM_ROOT]/gems/activesupport-8.1.1/lib/active_support/log_subscriber.rb","method":"ActiveSupport::LogSubscriber#call","source":{"145":"\n","146":"    def call(event)\n","147":"      super if logger\n","148":"    rescue =\u003e e\n","149":"      log_exception(event.name, e)\n"}},{"number":"180","file":"[GEM_ROOT]/gems/activesupport-8.1.1/lib/active_support/notifications/fanout.rb","method":"block in ActiveSupport::Notifications::Fanout::EventObjectGroup#finish","source":{"178":"\n","179":"          each do |s|\n","180":"            s.call(@event)\n","181":"          end\n","182":"        end\n"}},{"number":"24","file":"[GEM_ROOT]/gems/activesupport-8.1.1/lib/active_support/notifications/fanout.rb","method":"Array#each","source":{"22":"          when 0\n","23":"          when 1\n","24":"            collection.each(\u0026block)\n","25":"          else\n","26":"            exceptions = nil\n"}},{"number":"24","file":"[GEM_ROOT]/gems/activesupport-8.1.1/lib/active_support/notifications/fanout.rb","method":"ActiveSupport::Notifications::FanoutIteration#iterate_guarding_exceptions","source":{"22":"          when 0\n","23":"          when 1\n","24":"            collection.each(\u0026block)\n","25":"          else\n","26":"            exceptions = nil\n"}},{"number":"124","file":"[GEM_ROOT]/gems/activesupport-8.1.1/lib/active_support/notifications/fanout.rb","method":"ActiveSupport::Notifications::Fanout::BaseGroup#each","source":{"122":"\n","123":"        def each(\u0026block)\n","124":"          iterate_guarding_exceptions(@listeners, \u0026block)\n","125":"        end\n","126":"      end\n"}},{"number":"179","file":"[GEM_ROOT]/gems/activesupport-8.1.1/lib/active_support/notifications/fanout.rb","method":"ActiveSupport::Notifications::Fanout::EventObjectGroup#finish","source":{"177":"          @event.finish!\n","178":"\n","179":"          each do |s|\n","180":"            s.call(@event)\n","181":"          end\n"}},{"number":"259","file":"[GEM_ROOT]/gems/activesupport-
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions