简体   繁体   中英

Change Knock gem return rails

Hello thank you for reading me, I am trying to change the default return from the knock gem of rails, it returns a json with just a jwt element.

{
    "jwt": "token"
}

but I want to add elements to that response:

{
    "jwt": "token",
    "my element": "element 2"
}

is it possible, or need to make another request using that token to return more data?

If you could help me I will be very grateful, greetings.

Try this:

render json: {
      jwt: "token",
      element: "you data",
    }, status: :ok

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM