Skip to content

Commit

Permalink
fix for article permalinks under slices, now treated as relative to t…
Browse files Browse the repository at this point in the history
…he mount point for a slice
  • Loading branch information
El Draper committed Mar 23, 2009
1 parent d493979 commit 01750bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/feather.rb
Expand Up @@ -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
Expand Down

0 comments on commit 01750bc

Please sign in to comment.