2016-09-20 56 views
1

我是RoR的新手。如何記錄RESTful API?

有沒有什麼方法可以像Django REST Swagger那樣記錄RESTful API?

然後我找到了apipie-rails來記錄我的api。

但是當我試圖把它與Spree整合,我得到了以下錯誤:

Unable to autoload constant BaseControllerDecorator, expected /${PATH}/base_controller_decorator.rb to define it. 

base_controller_decorator.rb

Spree::Api::BaseController.class_eval do 

    # Some overrided functions 

end 

我發現的lib/apipie/application.rb中下面的代碼:

def load_controller_from_file(controller_file) 
    controller_class_name = controller_file.gsub(/\A.*\/app\/controllers\//,"").gsub(/\.\w*\Z/,"").camelize 
    controller_class_name.constantize 
end 

它似乎在裝飾器文件中實例化控制器,如何解決它?

回答