Class: Cuprum::Rails::Collection
- Inherits:
-
Collections::Collection
- Object
- Collections::Collection
- Cuprum::Rails::Collection
- Defined in:
- lib/cuprum/rails/collection.rb
Overview
Wraps an ActiveRecord model as a Cuprum collection.
Instance Method Summary collapse
-
#initialize(entity_class: nil, name: nil, qualified_name: nil, singular_name: nil, **options) ⇒ Collection
constructor
A new instance of Collection.
-
#query ⇒ Cuprum::Rails::Query
A new Query instance, used for querying against the collection data.
-
#record_class ⇒ Class
The class of entity represented by the collection.
Constructor Details
#initialize(entity_class: nil, name: nil, qualified_name: nil, singular_name: nil, **options) ⇒ Collection
Returns a new instance of Collection.
23 24 25 26 27 |
# File 'lib/cuprum/rails/collection.rb', line 23 def initialize(**params) params = disambiguate_keyword(params, :entity_class, :record_class) super(**params) end |
Instance Method Details
#query ⇒ Cuprum::Rails::Query
A new Query instance, used for querying against the collection data.
77 78 79 |
# File 'lib/cuprum/rails/collection.rb', line 77 def query Cuprum::Rails::Query.new(entity_class) end |
#record_class ⇒ Class
Returns the class of entity represented by the collection.
82 83 84 85 86 87 |
# File 'lib/cuprum/rails/collection.rb', line 82 def record_class tools.core_tools.deprecate '#record_class method', message: 'Use #entity_class instead' entity_class end |