在currency
的 Controller 中,我想重定向到prediction
的show方法。我怎样才能做到这一点?
def update
respond_to do |format|
if @currency.update(currency_params)
prediction = @currency.neural_network.predict
###redirect to prediction's controller, show method
###???
else
format.html { render :edit }
format.json { render json: @currency.errors, status: :unprocessable_entity }
end
end
end
最佳答案
您只需进行redirect_to 预测
Rails 将自动解析模型的路径。
关于ruby-on-rails - Rails 重定向到另一个 Controller 的 show 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30107792/