Ruby on rails Rails请求位置(MVC结构)

Ruby on rails Rails请求位置(MVC结构),ruby-on-rails,ruby-on-rails-3,model-view-controller,Ruby On Rails,Ruby On Rails 3,Model View Controller,我是Rails新手。我应该将以下代码放在哪里?其中name是/models/name中的一个文件夹 req = Name.new req.configure 这种逻辑应该放在这个类的控制器中(app/controllers/name) 例如: def new @req = Name.new @req.configure respond_to do |format| format.html # new.html.erb format.json { render js

我是Rails新手。我应该将以下代码放在哪里?其中
name
是/models/name中的一个文件夹

req = Name.new
req.configure

这种逻辑应该放在这个类的控制器中(app/controllers/name)

例如:

def new
  @req = Name.new
  @req.configure

  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @req }
  end
end
但是,您可以运行一些命令来自动设置这些设置,更多信息请访问:

我确实试过了,但我不明白你在问什么。