aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/railties
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-07-30 07:14:48 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-09-03 22:59:10 +0200
commitc7664d112fadb313146da33f48d1da318f249927 (patch)
tree926ace3a678884f4fe114a0ab2f9c112c4d4c7f2 /actionpack/lib/action_controller/railties
parent99131939316230065b4297573d080d1585e4e5a7 (diff)
downloadrails-c7664d112fadb313146da33f48d1da318f249927.tar.gz
rails-c7664d112fadb313146da33f48d1da318f249927.tar.bz2
rails-c7664d112fadb313146da33f48d1da318f249927.zip
Include application's helpers and router helpers by default, but include engine's ones for controllers inside isolated namespace
Diffstat (limited to 'actionpack/lib/action_controller/railties')
-rw-r--r--actionpack/lib/action_controller/railties/routes_helpers.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/railties/routes_helpers.rb b/actionpack/lib/action_controller/railties/routes_helpers.rb
new file mode 100644
index 0000000000..a23f703f0b
--- /dev/null
+++ b/actionpack/lib/action_controller/railties/routes_helpers.rb
@@ -0,0 +1,17 @@
+module ActionController
+ module Railties
+ module RoutesHelpers
+ def self.with(routes)
+ Module.new do
+ define_method(:inherited) do |klass|
+ super(klass)
+ if namespace = klass.parents.detect {|m| m.respond_to?(:_railtie) }
+ routes = namespace._railtie.routes
+ end
+ klass.send(:include, routes.url_helpers)
+ end
+ end
+ end
+ end
+ end
+end