ruby on rails - Always use responds_to? -
I have always specified the response format for action using responds_to blocks, such as:
of responses. Format | Format.js {Render: json = & gt; @record} And
Recently I realized that if you only support a format (as in the example above), you really do not need that block Is it the best practice to leave it, or to remove it?
I am going to isolate with the existing answer - I have responses for all my actions
I have to block I think that, while a bit more verbose, it documents the documents themselves more clearly. This makes it easy to support additional formats in the future. Edit: This serves as a concierge. Any format declared in the block is not automatically "406 acceptable"
Comments
Post a Comment