我认为我的路由可能存在问题。当我提交有错误的表单时,我的网址会发生变化。
因此,网址开头为:http://localhost:3000/user_profile/edit
然后我提交了一个错误表单:
现在网址为:http://localhost:3000/user_profile.17
控制器:
games_without_result = Game.objects.filter(result__isnull=True)
路线:
def update
@user_profile = current_user.user_profile
if @user_profile.update_attributes(user_profile_params)
flash[:success] = "Profile updated"
if params[:user_profile][:procedure_ids] == nil
redirect_to user_dashboards_show_path
# If competencies were modified, redirect to competency details
else
redirect_to edit_competency_details_path
end
else
render 'edit'
end
end