Class: AmsLazyRelationships::Loaders::Association

Inherits:
Base
  • Object
show all
Defined in:
lib/ams_lazy_relationships/loaders/association.rb

Overview

Lazy loads (has_one/has_many/has_many_through/belongs_to) ActiveRecord associations for ActiveRecord models

Instance Method Summary collapse

Methods inherited from Base

#load

Constructor Details

#initialize(model_class_name, association_name) ⇒ Association

Returns a new instance of Association.

Parameters:

  • model_class_name (String)

    The name of AR class for which the associations are loaded. E.g. When loading comment.blog_post it’d be “BlogPost”.

  • association_name (Symbol)

    The name of association being loaded E.g. When loading comment.blog_post it’d be :blog_post



15
16
17
18
# File 'lib/ams_lazy_relationships/loaders/association.rb', line 15

def initialize(model_class_name, association_name)
  @model_class_name = model_class_name
  @association_name = association_name
end