Parent

Included Modules

Files

Class Index [+]

Quicksearch

ActiveRecord::Result

 

This class encapsulates a Result returned from calling exec_query on any database connection adapter. For example:

  x = ActiveRecord::Base.connection.exec_query('SELECT * FROM foo')
  x # => #<ActiveRecord::Result:0xdeadbeef>

Attributes

columns[R]
rows[R]

Public Class Methods

new(columns, rows) click to toggle source
    # File lib/active_record/result.rb, line 13
13:     def initialize(columns, rows)
14:       @columns   = columns
15:       @rows      = rows
16:       @hash_rows = nil
17:     end

Public Instance Methods

each() click to toggle source
    # File lib/active_record/result.rb, line 19
19:     def each
20:       hash_rows.each { |row| yield row }
21:     end
to_hash() click to toggle source
    # File lib/active_record/result.rb, line 23
23:     def to_hash
24:       hash_rows
25:     end

Private Instance Methods

hash_rows() click to toggle source
    # File lib/active_record/result.rb, line 28
28:     def hash_rows
29:       @hash_rows ||= @rows.map { |row|
30:         Hash[@columns.zip(row)]
31:       }
32:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.