提交 4cd6f775 编写于 作者: P Piotr Sarnacki

We don't need delegating polymorphic_url and polymorphic_path anymore

上级 a132229d
...@@ -264,16 +264,6 @@ def install_helpers(destinations = [ActionController::Base, ActionView::Base], r ...@@ -264,16 +264,6 @@ def install_helpers(destinations = [ActionController::Base, ActionView::Base], r
class RoutesProxy class RoutesProxy
include ActionDispatch::Routing::UrlFor include ActionDispatch::Routing::UrlFor
%w(url_options polymorphic_url polymorphic_path).each do |method|
self.class_eval <<-RUBY, __FILE__, __LINE__ +1
def #{method}(*args)
scope.send(:_with_routes, routes) do
scope.#{method}(*args)
end
end
RUBY
end
attr_accessor :scope, :routes attr_accessor :scope, :routes
alias :_routes :routes alias :_routes :routes
...@@ -281,6 +271,12 @@ def initialize(routes, scope) ...@@ -281,6 +271,12 @@ def initialize(routes, scope)
@routes, @scope = routes, scope @routes, @scope = routes, scope
end end
def url_options
scope.send(:_with_routes, routes) do
scope.url_options
end
end
def method_missing(method, *args) def method_missing(method, *args)
if routes.url_helpers.respond_to?(method) if routes.url_helpers.respond_to?(method)
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1 self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册