Module: EagerEye::Detectors::Concerns::VariableModelInference
- Included in:
- EagerEye::Detectors::CustomMethodQuery, LoopAssociation
- Defined in:
- lib/eager_eye/detectors/concerns/variable_model_inference.rb
Overview
Tracks the inferred model class behind a local/instance variable, by
walking AST value-nodes down to a :const (e.g. User.where(...) →
"User"). Recurses into argument lists of relation-wrapper methods
(pagy, paginate, ...) so that pagy(User.includes(...)) is still
recognized as a User-relation.
Constant Summary collapse
- RELATION_WRAPPERS =
Methods whose first positional argument is the underlying relation (Pagy/Kaminari/etc.). Walking into those args lets us see through the wrapper to the source query.
%i[pagy paginate page kaminari with_pagy].freeze
- PAGINATION_META_NAMES =
LHS names in
@pagy, items = pagy(query)-style assignments that should not inherit the relation's model — they hold pagination metadata, not records. %i[pagy paginator meta page_info pagination].freeze