aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-07-31 11:27:08 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-09-03 22:59:10 +0200
commit99131939316230065b4297573d080d1585e4e5a7 (patch)
tree763c0670b7224375593c2d76d4eae12b2688dbcf /actionpack/lib/action_dispatch
parent8fdeff0fa5c4ebf01856b0048dd86f7151fd11ba (diff)
downloadrails-99131939316230065b4297573d080d1585e4e5a7.tar.gz
rails-99131939316230065b4297573d080d1585e4e5a7.tar.bz2
rails-99131939316230065b4297573d080d1585e4e5a7.zip
For view_context we need to initialize RoutesProxy in context of controller, not view, quick fix, I need to dig into it later
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 121e7c2c75..c67b0199ce 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -301,11 +301,13 @@ module ActionDispatch
MountedHelpers
end
- def define_mounted_helper(name, helpers = nil)
+ def define_mounted_helper(name)
+ return if MountedHelpers.method_defined?(name)
+
routes = self
MountedHelpers.class_eval do
define_method "_#{name}" do
- RoutesProxy.new(routes, self)
+ RoutesProxy.new(routes, (self.respond_to?(:controller) ? controller : self))
end
end