3 ms·
The author is claiming that the order ends up NOT being the order they're defined, but without examples it's hard to tell if the problem is that or that the reg
by 33degrees 8y ago
The author is claiming that the order ends up NOT being the order they're defined, but without examples it's hard to tell if the problem is that or that the regular expressions being defined are not working as intended
- bhaak 8y ago"Now imagine not having a classical style Sinatra app, but a modular one." I think the author ran into an issue where files were loaded differently in development mode than in production mode. Likely in development mode only the required files were loaded and the file with the more important routes wasn't. I wonder why that didn't show up in their tests. But I also wonder if they aren't using Sinatra for too large projects. If you have routes defined over several files, it's likely to get problematic. Maybe they should be using a more complete web framework like Padrino or go all the way with Rails.
- ryanbrunner 8y agoEven in a modular project, this seems like a smell. I can certainly imagine load order making things confusing when routes are required in, but I can't think of a good reason why modular projects should have any contention at all between what routes they handle.
- onli 8y agoIt wasn't that setup related. pc-kombo does not need that many routes that I did spread it over multiple files. I generally do avoid that. I wanted to give the specific example at first, but did not find the related commits anymore when writing the article, and in the end if it was really related to some behavior change linked to a version change (or x86 vs ARM) it would not be too useful now. It's meant as an example for the rough edges one can encounter. But the essence is that I had some routes defined using regexpressions, probably like the URL definition for a page in the blog (not saying it was exactly this one): get %r{/([0-9]+)/([\w]+)} do |id, title| And I ran into a situation where on my local dev platform this did not trigger when calling a similar looking route, but on the production server it did. I just remember being surprised that the specificity of the regex-evaluation seemed to change.