Skip to content

Commit

Permalink
MonkeyPatch UrlHelper for broken routing
Browse files Browse the repository at this point in the history
> When there's an optional scope, `link_to resource` doesn't seem to work
> properly in rails 4

The fix was taken from https://git.io/v6otV. It looks like this is still
an issue, so we might want to extract this monkeypatch out in to its own
file if it's still broken by the time we get to Rails 4.2.

- svenfuchs/routing-filter#47
- rails/rails#12178
- rails/rails#22767
  • Loading branch information
garethrees committed Sep 15, 2016
1 parent e1b3894 commit e1b7f4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/routing_filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ def locales=(locales)
end
end
end

ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper.class_eval do
def self.optimize_helper?(route)
false
end
end

0 comments on commit e1b7f4b

Please sign in to comment.