Created
March 14, 2009 13:06
-
-
Save myabc/79061 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config/router.rb b/config/router.rb | |
index e128a6a..23b9686 100644 | |
--- a/config/router.rb | |
+++ b/config/router.rb | |
@@ -32,14 +32,23 @@ Merb::Router.prepare do | |
# Adds the required routes for merb-auth using the password slice | |
slice(:merb_auth_slice_password, :name_prefix => nil, :path_prefix => "", :path => "blog/admin") | |
- | |
+ | |
+ # WORKAROUND: Deferred routes don't appear to be working correctly from the | |
+ # slice itself. | |
+ # This deferred route allows permalinks to be handled, without a separate rack handler | |
+ match(/\/blog\/.*/).defer_to do |request, params| | |
+ unless (id = Feather::Article.routing[request.uri.to_s.chomp("/").gsub(/\/blog/,'')]).nil? | |
+ {:controller => "feather/articles", :action => "show", :id => id} | |
+ end | |
+ end | |
+ | |
slice(:feather, :name_prefix => nil, :path_prefix => nil, :path => "blog") | |
- | |
+ | |
# This is the default route for /:controller/:action/:id | |
# This is fine for most cases. If you're heavily using resource-based | |
# routes, you may want to comment/remove this line to prevent | |
# clients from calling your create or destroy actions with a GET | |
- default_routes | |
+ # default_routes | |
# Change this for your home page to be available at / | |
match('/').to(:controller => 'home', :action =>'index') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment