Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 824 Bytes

UPGRADING.md

File metadata and controls

32 lines (22 loc) · 824 Bytes

Upgrading Grape::Rabl

Upgrading to >= 0.5

Fallback rendering when no RABL template is defined

Prior to v0.5.0, Grape::Rabl would always render content as JSON when no Rabl template was specified for a request. Beginning in v0.5.0 Grape::Rabl will now fallback to using the default response format as determined by Grape

class SampleApi < Grape::API
  format :xml
  formatter :xml, Grape::Formatter::Rabl

  get 'list' do
    %w[thing]
  end
end

Former behavior

response.body # => ["thing"]

Current behavior

response.body # => <?xml version="1.0" encoding="UTF-8"?>\n<strings type="array">\n  <string>thing</string>\n</strings>

See #34 for more information.