Sha256: 89fb4d1639c5b706c03fe2c5c00dde1acf22dd6cb9b38dd63147a85dc4b87a60
Contents?: true
Size: 797 Bytes
Versions: 2
Compression:
Stored size: 797 Bytes
Contents
class ActionDispatch::Routing::Mapper def comfy_route_blog(options = {}) options[:path] ||= 'blog' path = ['(:cms_path)', options[:path], '(:blog_path)'].join('/') namespace :blog, :path => path, :constraints => {:blog_path => /\w[a-z0-9_-]*/} do with_options :constraints => {:year => /\d{4}/, :month => /\d{1,2}/} do |o| o.get ':year' => 'posts#index', :as => :posts_of_year o.get ':year/:month' => 'posts#index', :as => :posts_of_month o.get ':year/:month/:slug' => 'posts#show', :as => :posts_dated end post ':slug/comments' => 'comments#create', :as => :comments get ':slug' => 'posts#serve', :as => :post get '/' => 'posts#serve', :as => :posts end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
comfy_blog-1.1.1 | lib/comfy_blog/routes/blog.rb |
comfy_blog-1.1.0 | lib/comfy_blog/routes/blog.rb |