diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-02-25 16:48:36 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-02-25 17:53:29 -0800 |
commit | fc4582fb6684ce72f5628629ea7d061659b790f8 (patch) | |
tree | 7d49d64d8ad3e7c91009e2b9804db9f7ed652177 /actionpack/lib/action_controller | |
parent | 36fd9efb5e4bfc9ac3acd4189d4dc457dea8102a (diff) | |
download | rails-fc4582fb6684ce72f5628629ea7d061659b790f8.tar.gz rails-fc4582fb6684ce72f5628629ea7d061659b790f8.tar.bz2 rails-fc4582fb6684ce72f5628629ea7d061659b790f8.zip |
Final pass at removing the router from a global constant
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railties/url_helpers.rb | 14 |
2 files changed, 22 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 5a16d82e49..3df70d4a4d 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -1,5 +1,5 @@ -require "action_controller" require "rails" +require "action_controller" require "action_view/railtie" require "active_support/core_ext/class/subclasses" @@ -8,6 +8,8 @@ module ActionController railtie_name :action_controller require "action_controller/railties/log_subscriber" + require "action_controller/railties/url_helpers" + log_subscriber ActionController::Railties::LogSubscriber.new initializer "action_controller.logger" do @@ -27,5 +29,9 @@ module ActionController initializer "action_controller.set_helpers_path" do |app| ActionController::Base.helpers_path = app.config.paths.app.helpers.to_a end + + initializer "action_controller.url_helpers" do |app| + ActionController::Base.extend ::ActionController::Railtie::UrlHelpers.with(app.routes) + end end -end +end
\ No newline at end of file diff --git a/actionpack/lib/action_controller/railties/url_helpers.rb b/actionpack/lib/action_controller/railties/url_helpers.rb new file mode 100644 index 0000000000..354d3fa898 --- /dev/null +++ b/actionpack/lib/action_controller/railties/url_helpers.rb @@ -0,0 +1,14 @@ +module ActionController + class Railtie + module UrlHelpers + def self.with(router) + Module.new do + define_method(:inherited) do |klass| + super + klass.send(:include, router.named_url_helpers) + end + end + end + end + end +end
\ No newline at end of file |