0

Im trying to return a custom HTTP response, based on condition I want to return true or false, the right response is calculated in my /api/validate function

Have tried nummerous things all fail. How to just return true or false?

1 Answer 1

1

Your can not return just true or false. You have to return correct http response with status code. For example

  • 200 OK – true
  • 422 Unprocessable Entity – false

Or you can always return 200 OK with hash object converted to JSON in body of your response. Something like

{ :result => true }.to_json
Sign up to request clarification or add additional context in comments.

1 Comment

somewhat in right direction :render => true was the way to go thx

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.