diff options
Diffstat (limited to 'config/routes.rb')
-rw-r--r-- | config/routes.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/config/routes.rb b/config/routes.rb index 70406de..f21fbba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,11 @@ if Rails.version < '3.0.0' ActionController::Routing::Routes.draw do |map| - map.blog_post '/blog', :controller => :blog_posts, :action => :index - map.blog_post '/blog/:id', :controller => :blog_posts, :action => :show - map.blog_category '/blog/categories/:category_id', :controller => :blog_posts, :action => :index - map.blog_post_blog_comments '/blog/:id/comments', :controller => :blog_posts, :action => :comment + map.namespace(:blog) do |blog| + blog.root :controller => "posts", :action => 'index' + blog.post '/blog/:id', :controller => "posts", :action => 'show' + blog.category '/blog/categories/:id', :controller => "categories", :action => 'show' + blog.post_blog_comments '/blog/:id/comments', :controller => 'posts', :action => 'comment' + end map.namespace(:admin, :path_prefix => 'refinery') do |admin| admin.namespace :blog do |blog| @@ -28,11 +30,12 @@ if Rails.version < '3.0.0' end else Refinery::Application.routes.draw do - match '/blog', :to => 'blog_posts#index', :as => 'blog_post' - match '/blog/:id', :to => 'blog_posts#show', :as => 'blog_post' - - match '/blog/categories/:category_id', :to => 'blog_posts#index', :as => 'blog_category' - match '/blog/:id/comments', :to => 'blog_posts#comment', :as => 'blog_post_blog_comments' + scope(:path => 'blog') do + root :to => 'posts#index' + match ':id', :to => 'posts#show', :as => 'post' + match 'categories/:id', :to => 'categories#show', :as => 'category' + match ':id/comments', :to => 'posts#comment', :as => 'post_blog_comments' + end scope(:path => 'refinery', :as => 'admin', :module => 'admin') do scope(:path => 'blog', :name_prefix => 'admin', :as => 'blog', :module => 'blog') do |