Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/calliope/routes.rb
Instance Method Summary collapse
Instance Method Details
#calliope(*blogs) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/calliope/routes.rb', line 4 def calliope(*blogs) = blogs. = { :path => ":name", :only => [:edit, :update] } [:constraints] = { :name => Regexp.new(blogs.map { |b| Regexp.escape(b.to_s) }.join('|')) } if blogs.any? resource :blog, do resources :posts, :except => :index do commentable :commentable => 'post' unless [:comments] == false end root :to => "posts#index", :via => :get end # match "/:blog/:year/:month/:day/:url_title" => "posts#show", # :constraints => options[:constraints], :as => "pretty_blog_post" end |