Question

When I curl or another server calls my server it interprets the format as */*. Since I've installed jbuilder it always repsonds with json.

How can I adjust the preference order for formats to respond to */*.

Était-ce utile?

La solution

The problem had to do with the respond_to action.

With an action that has:

respond_to do |fmt|
  fmt.json
  fmt.html
end

Any request of type */* will be json.

To make it html you just need to make it the first format that's responded to:

respond_to do |fmt|
  fmt.html
  fmt.json
end
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top