Sha256: 9d0185a7ca4ae203174fa6fa8a50301a91726905ff2e832ae55cba2663e1b568

Contents?: true

Size: 817 Bytes

Versions: 8

Compression:

Stored size: 817 Bytes

Contents

EffectivePosts::Engine.routes.draw do
  namespace :admin do
    resources :posts, :except => [:show]
  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

8 entries across 8 versions & 1 rubygems

Version Path
effective_posts-0.3.0 config/routes.rb
effective_posts-0.2.6 config/routes.rb
effective_posts-0.2.5 config/routes.rb
effective_posts-0.2.4 config/routes.rb
effective_posts-0.2.3 config/routes.rb
effective_posts-0.2.2 config/routes.rb
effective_posts-0.2.1 config/routes.rb
effective_posts-0.2.0 config/routes.rb