Is there a way to perform different routing in Rails' routes.rb depending on whether the request URL has a trailing slash? This seems difficult since the request object has its trailing slash removed, meaning a GET of http://www.example.com/about/ has a request.url value of http://www.example.com/about. That behavior prevents matching using request-based constraints as well as route-globbing.
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- Is there a way to remove IDV Tags from an AIFF fil
- Rails how to handle error and exceptions in model
相关文章
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
- Rspec controller error expecting <“index”> but
- Factory_girl has_one relation with validates_prese
One solution I've found is to use request.env["REQUEST_URI"], which contains the raw URL submitted with the request. Unfortunately, since it's not a direct string property of the request, it requires a custom matching object:
That seems like overkill, so hopefully someone has a more elegant approach.