Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
module Extensions module Routing module AbstractRequest def self.included(base) base.alias_method_chain :path, :localization end def path_with_localization @localized_path ||= Extensions::Routing.localize_path(path_without_localization) end end def self.localize_path(path) return "" if path.blank? path.split("/").map do |segment| case segment when "": segment when /\A:/: segment else fragment = UrlFragment.find_by_localized(segment) fragment.blank? ? segment : fragment.original end end.join("/") end end end
This paste will be private.
From the Design Piracy series on my blog: