Rahul
Rahul

Reputation: 47086

Changing the response status code when using rabl

I am building a rails api server with rabl as the json responder. For all the success methods, rabl's default status code is 200 but we have some internally assigned status codes for different scenario. Is there a way to change the status code when sending the response?

Upvotes: 1

Views: 501

Answers (1)

Igor Guzak
Igor Guzak

Reputation: 2165

if you render your view with respond_with or render methods, you could write:

render @something, status: 400

respond_with @smething, status: 400

rabl - just templating system for rendering resources

Upvotes: 3

Related Questions