module Volt::StoreRootHelpers

Public Instance Methods

get(attr_name, expand = false) click to toggle source
Calls superclass method
# File lib/volt/models/root_models/store_root.rb, line 21
def get(attr_name, expand = false)
  res = if attr_name.singular? && attr_name.to_sym != :id
    model_for_root.get(attr_name, expand)
  else
    super
  end

  res
end
model_for_root() click to toggle source
# File lib/volt/models/root_models/store_root.rb, line 11
def model_for_root
  root = nil
  Volt::Computation.run_without_tracking do
    root = get(:root_store_models).first_or_create
  end

  root
end
set(attr_name, value, &block) click to toggle source
Calls superclass method
# File lib/volt/models/root_models/store_root.rb, line 31
def set(attr_name, value, &block)
  if attr_name.singular? && attr_name.to_sym != :id
    Volt::Computation.run_without_tracking do
      model_for_root.then do |model|
        model.set(attr_name, value, &block)
      end
    end
  else
    super
  end
  # puts "SET---"
end