Skip to content

Commit

Permalink
Use url_for to generate search result urls
Browse files Browse the repository at this point in the history
  • Loading branch information
awagener committed Aug 10, 2010
1 parent 44e9658 commit 34db759
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions app/helpers/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ module SearchHelper
# this is where you register your result URLs based on the
# type of result we're dealing with
def result_url(result)
table_name = result.class.to_s.tableize
case table_name
when "news_items"
"/news/#{result.to_param}"
when "pages"
result.url
else
"/#{table_name}/#{result.to_param}"
end
result.respond_to?(:url) ? result.url : url_for(result)
end

end

0 comments on commit 34db759

Please sign in to comment.