Sha256: 0238669d9f283015d4742fd7b4a939ffbeff828b8ae7aa838b9c18c31034aa9a
Contents?: true
Size: 1001 Bytes
Versions: 2
Compression:
Stored size: 1001 Bytes
Contents
module RailsI18nRoutes module ActionDispatch module RouteSet module NamedRouteCollection def define_i18n_route_helper(name) ['url', 'path'].each do |kind| selector = url_helper_name(name, kind) @module.module_eval <<-END_EVAL, __FILE__, __LINE__ + 1 remove_possible_method :#{selector} def #{selector}(*args) options = args.extract_options! if Rails.application.config.i18n_routes.selection == :subdomain suffix = (options[:subdomain] ? options[:subdomain] : request.subdomain) else suffix = (options[:locale] ? options[:locale] : I18n.locale).to_s.gsub('-', '_').downcase end send ("#{name}_" + suffix.to_s + "_#{kind}"), *(args << options) end END_EVAL helpers << selector end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems