svenfuchs / routing-filter

routing-filter wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation.
http://www.artweb-design.de
MIT License
464 stars 84 forks source link

Support Rails 6.1 #76

Closed hasghari closed 3 years ago

hasghari commented 3 years ago

This PR maintains backwards compatibility with previous versions of Rails. All tests have been updated to use path_for instead of generate since the latter is only an intermediate result, not the final value for a generated rails path.

hasghari commented 3 years ago

Not sure why the Travis build is not showing up in the GitHub checks but all the tests are passing: https://www.travis-ci.com/github/hasghari/routing-filter

hasghari commented 3 years ago

Just realized that even though it's backwards compatible with earlier Rails versions, this PR does break compatibility with any custom filters implemented.

pmackay commented 3 years ago

@hasghari do you plan to update this to solve the custom filters issue?

hasghari commented 3 years ago

@hasghari do you plan to update this to solve the custom filters issue?

I think that depends on what the maintainer of this project wants to do. If they are comfortable with releasing a new version which breaks backwards-compatibility, then I can clean up this PR to remove the code that retains compatibility with earlier versions.

However if the desire is to do a minor release and not break backwards compatibility, then I can look into doing that.

Unfortunately I have not heard back from any of the maintainers.

simi commented 3 years ago

Feel free to prepare only 6.1 oriented release. There are no new features added to this library anymore. The only purpose is maintenance.

hasghari commented 3 years ago

Feel free to prepare only 6.1 oriented release. There are no new features added to this library anymore. The only purpose is maintenance.

@simi I've updated the PR for Rails 6.1 only. You can find the build here: https://www.travis-ci.com/github/hasghari/routing-filter

dbackeus commented 3 years ago

An update to Changelog with hints for what to look out for when upgrading would be nice. For example clarifying that the result received from yield when running around_generate etc will now be a wrapper class object rather than a basic 2 element Array.

simi commented 3 years ago

:wave:, upgrade guide would be nice. Anyway I'm wondering why anyone is still using routing filter in 2021. Can anyone please share their usecase?

adsteel commented 3 years ago

@simi we are still using it. We inherited that decision so it's just part of the core application's fabric at this point. It's used to send folks between v1 and v2 versions of our endpoints.

dbackeus commented 3 years ago

We're using routing-filter in a 17 year old Rails app (https://mynewsdesk.com).

Mainly for supporting customers hosting pages on our app on their own domain via CNAME. We have a lot of gnarly routing logic going on to support customers external domains (eg. subdomain.<customer-domain>.com), customer related subdomains on our own domain (eg. <customer-name>.mynewsdesk.com) as well as static internal subdomains on our own domain (eg. www.mynewsdesk.com, amp.mynewsdesk.com etc).

Main takeaway: Never ever use subdomains for routing if you can do it with regular path's instead 😬

simi commented 3 years ago

Thanks for the info. I was just wondering why you can't easily migrate to built-in Rails functionality today.

Anyway I'll take a look, merge and release new version soon.

pmackay commented 3 years ago

I've used it to solve exactly the first use case "Conditionally prepending the locale" - routing-filter was great to help solve that. Maybe there is a way to do that in Rails now but I tried a few experiments at the time and couldnt find a way to make it work.

geoffharcourt commented 3 years ago

We're using it (and this branch right now) for the same case as pmackay, to allow conditional prepending of the locale.

anitagraham commented 3 years ago

👋, upgrade guide would be nice. Anyway I'm wondering why anyone is still using routing filter in 2021. Can anyone please share their usecase?

It still seems to be in Refinery CMS. I tried upgrading to 6.1.1 from 6.0.3 and bumped into it again. I'll have a look at where it is used.
Oh, in refinerycms-i18n, so locales .

kennyadsl commented 3 years ago

We are also using (or at least suggesting to use) this gem in solidus_i18n.

jackiig commented 3 years ago

👋, upgrade guide would be nice. Anyway I'm wondering why anyone is still using routing filter in 2021. Can anyone please share their usecase?

Using this for routing affiliates in an insurance multi-rater.

shadydealer commented 3 years ago

Will a new version with this merge be released any time soon?

willfish commented 3 years ago

@svenfuchs Do you mind if we review and merge this? We're up against it with recent changes to Mimemagic's licensing and subsequent removal of all historic gems requiring a rails upgrade. I've had a look at the code in this PR and it looks fine to me but I'm definitely lacking the context that you have.

willfish commented 3 years ago

Thanks @simi