Permalink
Browse files

routed applications will respond to these methods

  • Loading branch information...
1 parent 002cf5f commit 1ae9f056c5ea5c588ebdf8adce03d35efd049139 @tenderlove tenderlove committed Jul 16, 2014
@@ -616,7 +616,7 @@ def app_name(app)
end
def define_generate_prefix(app, name)
- return unless app.respond_to?(:routes) && app.routes.respond_to?(:define_mounted_helper)
+ return unless app.respond_to?(:routes)
_route = @set.named_routes.routes[name.to_sym]
_routes = @set
@@ -200,7 +200,7 @@ def url_options
@url_options ||= default_url_options.dup.tap do |url_options|
url_options.reverse_merge!(controller.url_options) if controller
- if @app.respond_to?(:routes) && @app.routes.respond_to?(:default_url_options)
+ if @app.respond_to?(:routes)
url_options.reverse_merge!(@app.routes.default_url_options)
end

1 comment on commit 1ae9f05

Owner

jeremy commented on 1ae9f05 Jul 16, 2014

Non-Railtie Rack apps may respond to #routes. Resque::Server, for example, returns a Hash:

Blahg::Application.routes.draw do
  if Rails.env.development?
    require 'resque/server'
    mount Resque::Server, :at => "/resque"
  end
end
    actionpack/lib/action_dispatch/routing/mapper.rb:623:in `define_generate_prefix': undefined method `define_mounted_helper' for #<Hash:0x007fe29531ac98> (NoMethodError)
        from actionpack/lib/action_dispatch/routing/mapper.rb:586:in `mount'
        from config/routes.rb:418:in `block in <top (required)>'
Please sign in to comment.