Module: Babik::QuerySet::Projectable

Included in:
AbstractBase
Defined in:
lib/babik/queryset/mixins/projectable.rb

Overview

Project functionality of QuerySet

Instance Method Summary collapse

Instance Method Details

#project!(*attributes) ⇒ QuerySet

Prepares a projection of only some attributes



13
14
15
16
# File 'lib/babik/queryset/mixins/projectable.rb', line 13

def project!(*attributes)
  @_projection = Babik::QuerySet::Projection.new(@model, attributes)
  self
end

#projection?Boolean

Inform if there is the QuerySet is configured with a projection



27
28
29
30
# File 'lib/babik/queryset/mixins/projectable.rb', line 27

def projection?
  return true if @_projection
  false
end

#unproject!QuerySet

Removes the projection.



20
21
22
23
# File 'lib/babik/queryset/mixins/projectable.rb', line 20

def unproject!
  @_projection = nil
  self
end