I am new to RoR.
Is there any way to document RESTful api like Django REST Swagger
?
Then i found the apipie-rails
to document my api.
But when i try to integrate it with Spree
, i got the following error:
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
I found the following code in 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
It seems to instantiate the controller in decorator file, how to work it out?