module NoBrainer::Document::LazyFetch

Public Instance Methods

assign_attributes(attrs, options={}) click to toggle source
Calls superclass method
# File lib/no_brainer/document/lazy_fetch.rb, line 9
def assign_attributes(attrs, options={})
  if options[:lazy_fetch].present?
    lazy_fetch = options[:lazy_fetch]
    lazy_fetch = lazy_fetch.keys if lazy_fetch.is_a?(Hash)
    @lazy_fetch = Set.new(lazy_fetch.map(&:to_s))
  end
  super
end
reload(options={}) click to toggle source
Calls superclass method
# File lib/no_brainer/document/lazy_fetch.rb, line 18
def reload(options={})
  lazy_fetch = self.class.fields_to_lazy_fetch.to_a
  return super unless lazy_fetch.present?
  return super if options[:pluck]
  super(options.deep_merge(:without => lazy_fetch, :lazy_fetch => lazy_fetch))
end