Class: TranslationCms::Routers::TestimonialsRouter

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

Class Method Summary collapse

Class Method Details

.loadObject



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

def load
  Rails.application.routes.draw do
    if Structure.table_exists? && (root = Structure.with_type(StructureType.testimonials).first)
      localized do
        scope page: /\d{1,5}/, per: /\d{1,3}/, id: /\d{1,5}/,
              format: false, defaults: { format: 'html' } do
          get "/#{root.slug}(/p/:page)(/per/:per)", to: 'testimonials#index', as: :testimonials
          get "/#{root.slug}/:id(/p/:page)(/per/:per)", to: 'testimonials#search', as: :search_testimonials
        end
      end
    end
  end
end

.reloadObject



21
22
23
# File 'lib/translation_cms/routers/testimonials_router.rb', line 21

def reload
  Rails.application.routes_reloader.reload!
end