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.'}

此外,您可以使用参数指定路径,如下所示:

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