class AmsLazyRelationships::Core::LazyRelationshipMeta
Internal helper class for keeping relationship details
Attributes
load_for[R]
loader[R]
name[R]
reflection[R]
Public Class Methods
new(name:, loader:, reflection:, load_for: nil)
click to toggle source
@param name [String/Symbol] lazy relationship name. Can be different than the relationship name @param loader [Object] lazy loader for the relationship. Has to respond to `load(record, &block)`. @param reflection [Object] AMS relationship meta. Keeps data like the serializer for the relationship.
This data structure differs for various AMS versions.
@param load_for
[Symbol] Optionally you can delegate the loading to
a method defined by `load_for` symbol. It is useful e.g. when the loaded object is a decorated object and the real AR model is accessible by calling the decorator's method.
# File lib/ams_lazy_relationships/core/lazy_relationship_meta.rb, line 14 def initialize(name:, loader:, reflection:, load_for: nil) @name = name.to_sym @loader = loader @reflection = reflection @load_for = load_for end