Class: Cuprum::Rails::Query
- Inherits:
-
Collections::Query
- Object
- Collections::Query
- Cuprum::Rails::Query
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/cuprum/rails/query.rb
Overview
Interface for performing query operations on a Rails collection.
Instance Attribute Summary collapse
-
#record_class ⇒ Class
readonly
The class of the collection items.
Instance Method Summary collapse
-
#initialize(record_class, native_query: nil) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(record_class, native_query: nil) ⇒ Query
Returns a new instance of Query.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cuprum/rails/query.rb', line 23 def initialize(record_class, native_query: nil) super() default_order = { record_class.primary_key => :asc } @native_query = native_query || record_class.order(default_order) @record_class = record_class @limit = nil @offset = nil @order = default_order end |
Instance Attribute Details
#record_class ⇒ Class (readonly)
Returns the class of the collection items.
35 36 37 |
# File 'lib/cuprum/rails/query.rb', line 35 def record_class @record_class end |