Module: ActiveRecord::CursorExtensions

Extended by:
ActiveSupport::Concern
Included in:
Relation
Defined in:
lib/active_record/postgresql_cursors/cursors.rb

Instance Method Summary collapse

Instance Method Details

#cursor(*args) ⇒ Object

Find using cursors. A PostgreSQLCursor object will be returned, which can then be used as an Enumerable to loop through the results.

By default, cursor names are generated automatically using “cursor_#rand”, where rand is a big ol’ random number that is pretty unlikely to clash if you’re using nested cursors. Alternatively, you can supply a specific cursor name by supplying a :cursor_name option.



16
17
18
# File 'lib/active_record/postgresql_cursors/cursors.rb', line 16

def cursor(*args)
  find_with_cursor('cursor', *args)
end