diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-13 14:47:04 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-13 14:47:04 -0700 |
commit | d08810e2a6ef1597bfa7a1604f9e671a6f46c4bb (patch) | |
tree | 1d0a00b263975fa50ef2767195998f2665db78f8 /actionpack | |
parent | 6457ed41267975abe96b3d50364ba6b3a333b16f (diff) | |
download | rails-d08810e2a6ef1597bfa7a1604f9e671a6f46c4bb.tar.gz rails-d08810e2a6ef1597bfa7a1604f9e671a6f46c4bb.tar.bz2 rails-d08810e2a6ef1597bfa7a1604f9e671a6f46c4bb.zip |
extend with a module then use define_method
no need for redefine_method
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 4c20974ac7..d75ea9394c 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -578,18 +578,15 @@ module ActionDispatch _route = @set.named_routes.routes[name.to_sym] _routes = @set app.routes.define_mounted_helper(name) - app.routes.singleton_class.class_eval do - redefine_method :mounted? do - true - end - - redefine_method :_generate_prefix do |options| + app.routes.extend Module.new { + def mounted?; true; end + define_method :_generate_prefix do |options| prefix_options = options.slice(*_route.segment_keys) # we must actually delete prefix segment keys to avoid passing them to next url_for _route.segment_keys.each { |k| options.delete(k) } _routes.url_helpers.send("#{name}_path", prefix_options) end - end + } end end |