1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Move ActionController::Railties::RoutesHelpers and ActionMailer::Railties::RoutesHelper to AbstractController::Railties::RoutesHelpers

This commit is contained in:
Piotr Sarnacki 2010-08-02 17:38:44 +02:00
parent 32baa27892
commit 4131a2d804
4 changed files with 5 additions and 22 deletions

View file

@ -1,6 +1,6 @@
require "action_mailer"
require "rails"
require "action_mailer/railties/routes_helpers"
require "abstract_controller/railties/routes_helpers"
module ActionMailer
class Railtie < Rails::Railtie
@ -19,7 +19,7 @@ module ActionMailer
options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
ActiveSupport.on_load(:action_mailer) do
extend ::ActionMailer::Railties::RoutesHelpers.with(app.routes)
extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
include app.routes.mounted_helpers(:app)
options.each { |k,v| send("#{k}=", v) }
end

View file

@ -1,4 +1,4 @@
module ActionMailer
module AbstractController
module Railties
module RoutesHelpers
def self.with(routes)

View file

@ -4,7 +4,7 @@ require "action_dispatch/railtie"
require "action_view/railtie"
require "active_support/deprecation/proxy_wrappers"
require "active_support/deprecation"
require "action_controller/railties/routes_helpers"
require "abstract_controller/railties/routes_helpers"
module ActionController
class Railtie < Rails::Railtie
@ -51,7 +51,7 @@ module ActionController
options.helpers_path ||= paths.app.helpers.to_a
ActiveSupport.on_load(:action_controller) do
extend ::ActionController::Railties::RoutesHelpers.with(app.routes)
extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
include app.routes.mounted_helpers(:app)
options.each { |k,v| send("#{k}=", v) }
end

View file

@ -1,17 +0,0 @@
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