Skip to content

Undefined method map for nil when config.active_record.query_log_tags_enabled is true #117

@MaksJS

Description

@MaksJS

On Rails 7.1, when setting config.active_record.query_log_tags_enabled to true, I get this error:

undefined method map' for nil`

        def type_casted_binds(binds)
          binds.map do |value|
            if ActiveModel::Attribute === value
              type_cast(value.value_for_database)
            else

in [activerecord (7.1.2) lib/active_record/connection_adapters/abstract/quoting.rb:235:in type_casted_binds']`

We always go into this line:

 result = connection.select_all(sanitize_sql([ query, values ]), "#{name} Load", nil, preparable: false)

and binds are nil because connection.prepare_statements? is false, due to https://github.com/rails/rails/blob/581074c40d0989ff1d981086043b40dc8daa4888/activerecord/lib/active_record/railtie.rb#L422

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions