6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/rails_i18n_routes/action_dispatch/route_set/named_route_collection.rb', line 6
def define_i18n_route_helper(name)
['url', 'path'].each do |kind|
selector = url_helper_name(name, kind)
@module.module_eval " remove_possible_method :\#{selector}\n def \#{selector}(*args)\n options = args.extract_options!\n if Rails.application.config.i18n_routes.selection == :subdomain\n suffix = (options[:subdomain] ? options[:subdomain] : request.subdomain)\n else\n suffix = (options[:locale] ? options[:locale] : I18n.locale).to_s.gsub('-', '_').downcase\n end\n send (\"\#{name}_\" + suffix.to_s + \"_\#{kind}\"), *(args << options)\n end\n END_EVAL\n helpers << selector\n end \nend\n", __FILE__, __LINE__ + 1
|