2

I'm just starting to work with rails-api, and I wanted to implement some admin user interface for the backend side. As I'm used to activeadmin gem, I tried to use it here. I followed some steps to enable the middleware needed to run it, since it was in API mode.

One of the steps was to change in the application_controller.rb the following:

class ApplicationController < ActionController::API
end

to

class ApplicationController < ActionController::Base
end

and then create a api_controller.rb and make it inherit from ActionController::API

class ApiController < ActionController::API
end

following these steps I have activeadmin running well. My problem is that now when I trie to run rails generate scaffold command to generate new models it stops at

invoke  inherited_resources_controller

and throws the next error:

Could not find "api_controller.rb" in any of your source paths.

I suppose that I can just could the controller manually and it would be fine(?), but I would still like to know why this happens and how to fix it as it would save me time.

the_storyteller
  • 2,335
  • 1
  • 26
  • 37
  • [This closed IR PR](https://github.com/activeadmin/inherited_resources/pull/438) might be related, your solution looks good. – Piers C Oct 30 '18 at 15:29

1 Answers1

4

after a lot of reading, I solved my problem adding this to my application.rb:

config.app_generators.scaffold_controller = :scaffold_controller