6
私は_new_form.html.erb
を私のnew.html.erb
にレンダリングされるように設定しました。ユーザーがこのフォームを更新し、いくつかの基本的な検証をパスした後、_new_form.html.erb
というフルフォームを表示するedit.html.erb
にリダイレクトさせていただきたいと思います。redirect_to編集
これは基本的なものだと確信していますが、それを行う方法がわかりません。
私のContollerでアクションを作成しましたが、ここではここで取り組んでいます。
すなわち
def create
@location = Location.new(params[:location])
#redirect_to :action => "edit"
respond_to do |format|
if @location.save
format.html { redirect_to edit_location_path(:id), notice: 'Location was successfully created.' }
format.json { render json: @location, status: :created, location: @location }
else
format.html { render action: "new" }
format.json { render json: @location.errors, status: :unprocessable_entity }
end
end
end
賢い、ありがとうございます。 – Holly