0

:user_idリダイレクト時にインデックスコントローラーに送信したい:

format.html { redirect_to @employee_personal, notice: 'Personal was successfully updated.'}

私のインデックスコントローラーでは、以下を送信する必要があります:

@user_id = @employee_personal.user_id

変数。

どうすればこれを送信できますか? 私が試したリダイレクトで:

format.html { redirect_to @employee_personal(:user_id => @user_id), notice: 'Personal was successfully updated.' }

違います。

format.html { redirect_to :action => :index, :user_id => @user_id  }

は正しい。

その形式でそのエラーを正しくするにはどうすればよいですか?

4

1 に答える 1

1

試す:

format.html { redirect_to @employee_personal, user_id: @user_id, notice: 'Personal was successfully updated.'}

また、次のように params でパスを指定することもできます。

format.html { redirect_to employee_personal_path(@employee_personal, user_id: @user_id), notice: 'Personal was successfully updated.'}
于 2012-12-26T08:26:42.843 に答える