Run Generate Controller command from a Module

一笑奈何 提交于 2019-12-25 05:24:41

问题


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:

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:


To generate namespaced controller you should type, for example:

rails g controller performance/base


来源:https://stackoverflow.com/questions/17153286/run-generate-controller-command-from-a-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!