Permalink
Browse files

untranslated route compatible with Rails 3.2

  • Loading branch information...
1 parent 979a20a commit 3a481d89c5002f133978de77bda53b947b8762a2 @narbo narbo committed with May 1, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/rails-translate-routes.rb
@@ -290,8 +290,15 @@ def translate_route route, locale
# Re-generate untranslated routes (original routes) with name set to nil (which prevents conflict with default untranslated_urls)
def untranslated_route route
- conditions = { :path_info => route.path }
- conditions[:request_method] = parse_request_methods route.conditions[:request_method] if route.conditions.has_key? :request_method
+ conditions = {}
+ if Rails.version >= '3.2'
+ conditions[:path_info] = route.path
+ conditions[:request_method] = parse_request_methods route.verb if route.verb != //
+ conditions[:subdomain] = route.constraints[:subdomain] if route.constraints
+ else
+ conditions[:path_info] = route.path
+ conditions[:request_method] = parse_request_methods route.conditions[:request_method] if route.conditions.has_key? :request_method
+ end
requirements = route.requirements
defaults = route.defaults

0 comments on commit 3a481d8

Please sign in to comment.