module Babik::QuerySet::Projectable
Project functionality of QuerySet
Public Instance Methods
project!(*attributes)
click to toggle source
Prepares a projection of only some attributes @param *attributes [Array] Attributes that will be projected.
Each one of these can be a local field, or a foreign entity field. Babik will take care of joins.
@return [QuerySet] Reference to this QuerySet
.
# File lib/babik/queryset/mixins/projectable.rb, line 13 def project!(*attributes) @_projection = Babik::QuerySet::Projection.new(@model, attributes) self end
projection?()
click to toggle source
Inform if there is the QuerySet
is configured with a projection @return [Boolean] True if there is a projection configured, false otherwise.
# File lib/babik/queryset/mixins/projectable.rb, line 27 def projection? return true if @_projection false end
unproject!()
click to toggle source
Removes the projection. @return [QuerySet] Reference to this QuerySet
.
# File lib/babik/queryset/mixins/projectable.rb, line 20 def unproject! @_projection = nil self end