I just finished reading the rest, I think the above code should be refactored in the api/base_controller and apply it to all controllers that require it via a before_filter. At the end of the day it's very similar code duplicated in all controllers and it'd be easier to maintain and cleaner if it's all kept in the