Thanks for the feedback guys.
> In my experience, however, it's usually more than just the view that changes between versions. The controller receives customizations as well, sometimes. Therefore, I think that versioning the views is not a "majority case" and shouldn't be a core feature.
Ryan, we've updated our samples to show how changes to your API logic (per version) can be accounted for in your controllers to ensure backwards/forwards compatibility :
class PostsController < ApplicationController
def index
# shared code for all versions
@posts = Post.scoped
# version 3 or greated supports embedding post comments
if requested_version >= 3
@posts = @posts.includes(:comments)
end
end
end
It's just a simple comparison against the view version.
The beauty of the view based APIs is that they allow you to easily reuse your existing controller logic. Separating of API logic into their own controllers doesn't have that advantage.
So our solution covers both the controller, allowing you to make exceptions to ensure forwards/backwards compatibility by simply checking against the current version (please see our updated examples) and then the aforementioned view version with degradation support.
Jim Jones