diff options
author | Robin Houston <robin@lenny.robin> | 2011-07-17 22:29:47 +0100 |
---|---|---|
committer | Robin Houston <robin@lenny.robin> | 2011-07-17 22:29:47 +0100 |
commit | 7b96f465eb908205286b7f6ec004f66145c14f4b (patch) | |
tree | b3ad3667653411ec5ca7fc4dfceafe3e3151d657 /lib | |
parent | d2bae4563be978e99b4eb6c7daa95db67a51a41e (diff) | |
parent | c0391ee9f9e53ae28100815d396bc8d6eac949d2 (diff) |
Merge branch 'master' into wdtk
Conflicts:
config/routes.rb
Diffstat (limited to 'lib')
-rw-r--r-- | lib/routing_filters.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/routing_filters.rb b/lib/routing_filters.rb new file mode 100644 index 000000000..cdb58e7c1 --- /dev/null +++ b/lib/routing_filters.rb @@ -0,0 +1,9 @@ +module RoutingFilter + class Conditionallyprependlocale < RoutingFilter::Locale + # Override core Locale filter not to prepend locale path segment + # when there's only one locale + def prepend_locale?(locale) + locale && I18n.available_locales.length > 1 && (self.class.include_default_locale? || !default_locale?(locale)) + end + end +end |