instance method each_hash

Ruby on Rails 7.2.3

Since v7.1.6 Last seen in v7.2.3 Private

Available in: v7.1.6 v7.2.3

Signature

each_hash(result)

No documentation comment.

Parameters

result req
Source
# File activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb, line 152
        def each_hash(result)
          return to_enum(:each_hash, result) unless block_given?

          keys = result.fields.map(&:to_sym)
          result.rows.each do |row|
            hash = {}
            idx = 0
            row.each do |value|
              hash[keys[idx]] = value
              idx += 1
            end
            yield hash
          end

          nil
        end

Defined in activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb line 152 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::TrilogyAdapter

Type at least 2 characters to search.

↑↓ navigate · open · esc close