0

私はRailsの初心者です。次のコードをどこに配置しますか - name/models/name のフォルダーはどこですか

req = Name.new
req.configure
4

1 に答える 1

0

この種のロジックは、このクラス (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

ただし、これをすべて自動的に設定するために実行できるコマンドがあります。詳細については、http: //guides.rubyonrails.org/getting_started.htmlを参照してください。

于 2013-04-03T13:05:24.683 に答える