I am wondering if it is considered reasonable to add app code inside of the block passed to format.xxx inside of the respond_to? For example, rails code generator gives us something like:
@object = Object.new
...
... several lines of other app code ...
...
respond_to do |format|
format.xml {render :xml => @object}
end
But, what if I instead do something like this:
respond_to do |format|
format.xml {
@object = Object.new
...
... several lines of other app code ...
...
render :xml => @object
}
end
Is there anything "wrong" or insecure about this approach? Note, I'm not interested in your opinion as to whether or not YOU would do it this way, I'm only interested in knowing if there are any downsides or security risks etc. to this approach.