Module: Babik::QuerySet::RelatedSelector
- Included in:
- AbstractBase
- Defined in:
- lib/babik/queryset/mixins/related_selector.rb
Overview
select_related functionality of QuerySet
Instance Method Summary collapse
-
#select_related!(association_paths) ⇒ Object
Load the related objects of each model object specified by the association_paths.
Instance Method Details
#select_related!(association_paths) ⇒ Object
Load the related objects of each model object specified by the association_paths
e.g.
-
User.objects.filter(first_name: ‘Julius’).select_related(:group)
-
User.objects.filter(first_name: ‘Cassius’).select_related([:group, :zone])
-
Post.objects.select_related(:author)
20 21 22 23 |
# File 'lib/babik/queryset/mixins/related_selector.rb', line 20 def (association_paths) @_select_related = Babik::QuerySet::SelectRelated.new(@model, association_paths) self end |