Sha256: 3201b25035e0009d45814b1a875dabca76fa24db1fcbc7994ca97fd764183684

Contents?: true

Size: 885 Bytes

Versions: 7

Compression:

Stored size: 885 Bytes

Contents

EffectivePosts::Engine.routes.draw do
  namespace :admin do
    resources :posts, :except => [:show]
    match 'posts/excerpts', :to => 'posts#excerpts', :via => [:get]
  end

  scope :module => 'effective' do
    resources :posts, :only => [:index, :show]

    if EffectivePosts.use_category_routes
      EffectivePosts.categories.each do |category|
        next if category.to_s == 'posts'

        match "#{category}", :to => 'posts#index', :via => [:get], :defaults => {:category => category.to_s }
        match "#{category}/:id", :to => 'posts#show', :via => [:get], :defaults => {:category => category.to_s }
      end
    end
  end

end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_posts-0.4.6 config/routes.rb
effective_posts-0.4.5 config/routes.rb
effective_posts-0.4.4 config/routes.rb
effective_posts-0.4.3 config/routes.rb
effective_posts-0.4.2 config/routes.rb
effective_posts-0.4.1 config/routes.rb
effective_posts-0.4.0 config/routes.rb