I’m looking into rendering more complex responses.
Specifically, I am searching for options for formatting yaml and json responses with multiple levels, but right now I cannot locate any api information on options.
I’ve seen something about :include and :only in other sample controllers. I’m wondering what the full range of options are for more complex rendering of documents (specifically yaml, but I’d like to learn for all)
For example:
def index
@people = Person.find(:all)
respond_to do |format|
format.* ?????????????????????
end
end
background: trying to assemble what is for me more complex yaml ouput and seeing what and how I can from the controller as opposed to having to build a specific view.
After reading through the rails code, I can safely say that there isn’t anything else that you don’t know about. (Although the documentation for
respond_toin block form seems to be missing from the API docs)Basically there are two ways to use
respond_toDeclarative
Block
You can’t use the options on the block form (it is a different method definition entirely), and
:onlyand:exceptare the only options that the declarative version accepts.