Comments (8)
I see.
Can someone provide a failing test case, please?
from routing-filter.
Here it is: clemens@01a9206.
from routing-filter.
Actually the constraints line should go before the other one because it's more specific (that's the rule in Rails 3, right?). What stays the same is that stuff is failing.
I still don't have a clue about the problem but one hint might be that constraint handling is a Rack middleware itself that relies on the X-Cascade header. So maybe routing filter needs to somehow take that into account? Just musing ...
from routing-filter.
Ah, thanks for the test case, Clemens.
Will have a look asap, although ... that might be next year ;)
from routing-filter.
Ok, I've had a look already.
The problem is related to the fact that Rack::Mount::RouteSet#call
yields a block to recognize
and this block calls return
in order to break out of the optimized_each
loop. Therefor it is not possible to actually wrap around that block. Whenever that return
is called it will immediately return to the original method no matter how many filtering blocks are wrapped around that inner block. Yeah, that's just like using GOTO behaved in BASIC in 1982.
I'm not sure how to get around this. I can't believe this stuff is so fricking hard, but it seems it actually is.
from routing-filter.
Has any progress on this issue ever been made? I'm running into the same thing myself and in trying to figure out a solution came to the same conclusions as you did a year ago, @svenfuchs.
from routing-filter.
I just ran into this problem too! Any ideas on how to fix it?
from routing-filter.
Ok, this fixes the problem I think, but of course is not a nice fix. I think an easy fix is not possible without refactoring parts of the core of this gem. Sven what do you think?
def recognize_with_filtering(request, &block)
path, route, matches, params = request.env['PATH_INFO'], nil, nil, nil
original_path = path.dup
# first run of filters to possibly change the request path
filters.run(:around_recognize, path, request.env) {{}}
recognize_without_filtering(request) do |route, matches, params|
request.env['PATH_INFO'] = original_path
filters.run(:around_recognize, original_path, request.env) do
params || {}
end
request.env['PATH_INFO'] = original_path
if block_given?
block.call(route, matches, params)
else
return route, matches, params
end
end
nil
end
from routing-filter.
Related Issues (20)
- 0.4.0.pre Does Not Do Proper Routing HOT 5
- Didn't work on rails 4 HOT 2
- Is this gem support alive? HOT 2
- Devise "Not found. Authentication passthru."
- rails4 undefined local variable or method map HOT 5
- Set :include_default_locale to true ignored HOT 5
- Support for case insensitive locales HOT 9
- Is there a plan to support Rails 5 ?
- New release ? HOT 8
- How to use filter in a block?
- I'm not able to make a custom filter work
- Routing Error instead of fallback to en
- Avoiding duplicate content SEO penalty HOT 2
- Why default locale is not fallen back to? HOT 1
- Update routing-filter to allow rails 5.2
- Won't work with Rails 6.1 HOT 5
- Please release new gem version HOT 4
- Filter locale breaks default_url_options in tests (setting the Locale from URL Params)
- README and repo description (on github) reference artweb-design HOT 1
- routing-filter doesn't seem to work with rails 7.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from routing-filter.