Class: TranslationCms::Routers::LandingPagesRouter

Inherits:
Object
  • Object
show all
Defined in:
lib/translation_cms/routers/landing_pages_router.rb

Class Method Summary collapse

Class Method Details

.loadObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/translation_cms/routers/landing_pages_router.rb', line 7

def load
  Rails.application.routes.draw do
    localized do
      return unless Structure.table_exists?

      Structure.visible.with_type(StructureType.landing).find_each do |root_structure|
        scope root_structure.slug, format: false, defaults: { format: 'html' } do
          get '', to: 'landings#show',
                  defaults: {
                    slug: root_structure.slug,
                    id: root_structure.id
                  }
        end
      end
    end
  end
end

.reloadObject



25
26
27
# File 'lib/translation_cms/routers/landing_pages_router.rb', line 25

def reload
  Rails.application.routes_reloader.reload!
end