Sha256: 26904a11f00469d2bcc03ffaf02978832a2e0b6e6e90e7d0f17d298771dfc51a

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

class ActionDispatch::Routing::Mapper

  def comfy_route_blog(options = {})
    ComfyBlog.configuration.public_blog_path = options[:path] || "blog"
    path = ["(:cms_path)", ComfyBlog.configuration.public_blog_path].join("/")

    scope module: :comfy, as: :comfy do
      namespace :blog, path: path do
        with_options constraints: { year: %r{\d{4}}, month: %r{\d{1,2}} } do |o|
          o.get ":year",              to: "posts#index",  as: :posts_of_year
          o.get ":year/:month",       to: "posts#index",  as: :posts_of_month
          o.get ":year/:month/:slug", to: "posts#show",   as: :post
          o.get "/",                  to: "posts#index",  as: :posts
        end
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comfy_blog-2.0.5 lib/comfy_blog/routes/blog.rb
comfy_blog-2.0.4 lib/comfy_blog/routes/blog.rb
comfy_blog-2.0.3 lib/comfy_blog/routes/blog.rb