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:
parent
32baa27892
commit
4131a2d804
4 changed files with 5 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
||||||
require "action_mailer"
|
require "action_mailer"
|
||||||
require "rails"
|
require "rails"
|
||||||
require "action_mailer/railties/routes_helpers"
|
require "abstract_controller/railties/routes_helpers"
|
||||||
|
|
||||||
module ActionMailer
|
module ActionMailer
|
||||||
class Railtie < Rails::Railtie
|
class Railtie < Rails::Railtie
|
||||||
|
@ -19,7 +19,7 @@ module ActionMailer
|
||||||
options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
|
options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
|
||||||
|
|
||||||
ActiveSupport.on_load(:action_mailer) do
|
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)
|
include app.routes.mounted_helpers(:app)
|
||||||
options.each { |k,v| send("#{k}=", v) }
|
options.each { |k,v| send("#{k}=", v) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module ActionMailer
|
module AbstractController
|
||||||
module Railties
|
module Railties
|
||||||
module RoutesHelpers
|
module RoutesHelpers
|
||||||
def self.with(routes)
|
def self.with(routes)
|
|
@ -4,7 +4,7 @@ require "action_dispatch/railtie"
|
||||||
require "action_view/railtie"
|
require "action_view/railtie"
|
||||||
require "active_support/deprecation/proxy_wrappers"
|
require "active_support/deprecation/proxy_wrappers"
|
||||||
require "active_support/deprecation"
|
require "active_support/deprecation"
|
||||||
require "action_controller/railties/routes_helpers"
|
require "abstract_controller/railties/routes_helpers"
|
||||||
|
|
||||||
module ActionController
|
module ActionController
|
||||||
class Railtie < Rails::Railtie
|
class Railtie < Rails::Railtie
|
||||||
|
@ -51,7 +51,7 @@ module ActionController
|
||||||
options.helpers_path ||= paths.app.helpers.to_a
|
options.helpers_path ||= paths.app.helpers.to_a
|
||||||
|
|
||||||
ActiveSupport.on_load(:action_controller) do
|
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)
|
include app.routes.mounted_helpers(:app)
|
||||||
options.each { |k,v| send("#{k}=", v) }
|
options.each { |k,v| send("#{k}=", v) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue