Sha256: 76c280e74b75658b8d78e272701106f883c5951b9f755a8d9115e65eddaddb91

Contents?: true

Size: 672 Bytes

Versions: 11

Compression:

Stored size: 672 Bytes

Contents

class EffectivePagesConstraint
  def self.matches?(request)
    Effective::Page.find(request.path_parameters[:id] || '/').present? rescue false
  end
end

EffectivePages::Engine.routes.draw do
  namespace :admin do
    resources :pages, except: [:show]
  end

  scope :module => 'effective' do
    get '*id', to: 'pages#show', constraints: EffectivePagesConstraint, as: :page
  end
end

# Automatically mount the engine as an append
Rails.application.routes.append do
  unless Rails.application.routes.routes.find { |r| r.name == 'effective_pages' }
    mount EffectivePages::Engine => '/', :as => 'effective_pages'
  end
end

#root to: 'effective/pages#show', id: 'home'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
effective_pages-2.1.0 config/routes.rb
effective_pages-2.0.9 config/routes.rb
effective_pages-2.0.8 config/routes.rb
effective_pages-2.0.7 config/routes.rb
effective_pages-2.0.6 config/routes.rb
effective_pages-2.0.5 config/routes.rb
effective_pages-2.0.4 config/routes.rb
effective_pages-2.0.3 config/routes.rb
effective_pages-2.0.2 config/routes.rb
effective_pages-2.0.1 config/routes.rb
effective_pages-2.0.0 config/routes.rb