app/models/comfy/cms/site.rb
# When site is marked as a mirror we need to sync its structure
# with other mirrors.
When site is marked as a mirror we need to sync its structure
with other mirrors.
When site is marked as a mirror we need to sync its structure with other mirrors .
def sync_mirrors
    return unless is_mirrored_changed? && is_mirrored?
    [self, Comfy::Cms::Site.mirrored.where("id != #{id}").first].compact.each do |site|
      site.layouts.reload
      site.pages.reload
      site.snippets.reload
      (site.layouts.roots + site.layouts.roots.map(&:descendants)).flatten.map(&:sync_mirror)
      (site.pages.roots + site.pages.roots.map(&:descendants)).flatten.map(&:sync_mirror)
      site.snippets.map(&:sync_mirror)
    end
  end
def sync_mirrors return unless is_mirrored_changed? && is_mirrored? [ self , Comfy :: Cms :: Site . mirrored . where ( "id != #{id}" ) . first ] . compact . each do | site | site . layouts . reload site . pages . reload site . snippets . reload ( site . layouts . roots + site . layouts . roots . map ( & :descendants ) ) . flatten . map ( & :sync_mirror ) ( site . pages . roots + site . pages . roots . map ( & :descendants ) ) . flatten . map ( & :sync_mirror ) site . snippets . map ( & :sync_mirror ) end end
When site is marked as a mirror we need to sync its structure
with other mirrors.
When site is marked as a mirror we need to sync its structure with other mirrors .