0

I'm using jbuiler to generate api, when I go generate a value, I do:

json.name type.name

I'd like to use the value type.name, for example, to generate the name of the value, this way I could generate an array with the name of my value:

json.type.name do
  json.array categories
end

How can I use a variable instead a static string for the value of my parameter?

Thanks!

1 Answer 1

1

you can do

json.set! type.name do
  json.array categories
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.