FIX: apply defaults constraints to routes format (#7890)

This fixes the problem where if a route ends with a dynamic segment and the segment contains a period e.g. `my.name`, `name` is interpreted as the format. This applies a default format constraints `/(json|html)/` on all routes. If you'd like a route to have a different format constraints, you can do something like this:

```ruby
get "your-route" => "your_controlller#method", constraints: { format: /(rss|xml)/ }

#or
get "your-route" => "your_controlller#method", constraints: { format: :xml }
```
This commit is contained in:
Osama Sayegh
2019-07-15 21:55:11 +03:00
committed by GitHub
parent 6515ff19e5
commit 7d01c5de1a
3 changed files with 53 additions and 47 deletions

View File

@@ -1065,7 +1065,10 @@ class UsersController < ApplicationController
@confirmed = true
end
render layout: 'no_ember'
respond_to do |format|
format.json { render json: success_json }
format.html { render layout: 'no_ember' }
end
end
def list_second_factors