Class: ActiveRecord::Result
- Includes:
- Enumerable
- Defined in:
- activerecord/lib/active_record/result.rb
Overview
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>
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(columns, rows) ⇒ Result
constructor
A new instance of Result.
- #to_hash ⇒ Object
Methods included from Enumerable
#as_json, #each_with_object, #exclude?, #group_by, #index_by, #many?, #sum
Constructor Details
#initialize(columns, rows) ⇒ Result
Returns a new instance of Result.
13 14 15 16 17 |
# File 'activerecord/lib/active_record/result.rb', line 13 def initialize(columns, rows) @columns = columns @rows = rows @hash_rows = nil end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns
11 12 13 |
# File 'activerecord/lib/active_record/result.rb', line 11 def columns @columns end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows
11 12 13 |
# File 'activerecord/lib/active_record/result.rb', line 11 def rows @rows end |