This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/api_v2_responder.rb | |
# This approach was heavily inspired by | |
# http://josephhsu.com/post/32746478033/rails-responders-api-versioning. | |
# Overriding the #to_json method wasn't right though, as it removed half of the | |
# awesome functionality of respond_with. | |
# | |
# @see https://github.com/rails/rails/blob/v3.2.17/actionpack/lib/action_controller/metal/responder.rb | |
class ApiV2Responder < ActionController::Responder | |
# Override the original `#display` method to wrap the passed in resource in | |
# the correspondingly named Presenter. |