Permalink
Browse files

fix for article permalinks under slices, now treated as relative to t…

…he mount point for a slice
  • Loading branch information...
El Draper
El Draper committed Mar 23, 2009
1 parent d493979 commit 01750bc4ae646a9aaa165ac0c10967139e281ba9
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/feather.rb
View
@@ -82,7 +82,11 @@ def self.setup_router(scope)
# This deferred route allows permalinks to be handled, without a separate rack handler
scope.match("/:controller", :controller => '.*').defer_to do |request, params|
- unless (id = Feather::Article.routing[request.uri.to_s.chomp("/")]).nil?
+ # Permalinks are relative to the slice mount point, so we'll need to remove that from the request before we look up the article
+ permalink = request.uri.to_s.chomp("/")
+ permalink.gsub!("/#{::Feather.config[:path_prefix]}", "") unless ::Feather.config[:path_prefix].blank?
+ # Attempt to find the article
+ unless (id = Feather::Article.routing[permalink]).nil?
params.merge!({:controller => "feather/articles", :action => "show", :id => id})
end
end

0 comments on commit 01750bc

Please sign in to comment.