Sha256: 935adf0d92ecc20d3e7858a1179b7856db3d5d6d16c5b02f5760d6bf5344d640
Contents?: true
Size: 658 Bytes
Versions: 2
Compression:
Stored size: 658 Bytes
Contents
module TranslatableRoutes module ActionDispatch module NamedRouteCollection extend ActiveSupport::Concern def define_i18n_url_helper(name) %w(path url).each do |type| helper = :"#{name}_#{type}" @module.remove_possible_method helper @module.module_eval do define_method helper do |*args| options = args.extract_options! suffix = (options[:locale] || I18n.locale).to_s.gsub('-', '_').downcase send "#{name}_#{suffix}_#{type}", *(args << options) end end helpers << helper end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
translatable_routes-1.3.2 | lib/translatable_routes/action_dispatch/named_route_collection.rb |
translatable_routes-1.3.0 | lib/translatable_routes/action_dispatch/named_route_collection.rb |