0

I know the basic command to create controllers in Rails is to use Rails generate controller

But in the code I see something like this structure below and was wondering how to do that?

The structure looks like this:

enter image description here

and the generated code looks like this, I need something similar:

module Performance
  class BaseController < ApplicationController
  end
end


module Performance
  class GroupsController < BaseController
    def show
    end

    def index
    end
  end
end

1 Answer 1

3

To generate namespaced controller you should type, for example:

rails g controller performance/base
Sign up to request clarification or add additional context in comments.

1 Comment

Ok I tried it now but it didn't generate that "module" stuff, I said for example rails g controller father/child and it created a directory called father, and a child_controller inside it but the source of that child_controller doesn't have "module" in it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.