私はRailsの初心者です。次のコードをどこに配置しますか - name
/models/name のフォルダーはどこですか
req = Name.new
req.configure
私は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
ただし、これをすべて自動的に設定するために実行できるコマンドがあります。詳細については、http: //guides.rubyonrails.org/getting_started.htmlを参照してください。