class ViewModel::TraversalContext

def nearest_root_viewmodel

def nearest_root_viewmodel
  if root?
    raise RuntimeError.new('Attempted to find nearest root from a root context. This is probably not what you wanted.')
  elsif parent_context.root?
    parent_viewmodel
  else
    parent_context.nearest_root_viewmodel
  end
end