15
在我的控制器破壞作用,我想這個項目刪除後重定向到索引,我想傳遞一個變量叫「檢查」時重定向:如何通過redirect_to傳遞一個變量?
def destroy
@Car = Car.find(params[:id])
checked = params[:checked]
if @car.delete != nil
end
redirect_to cars_path #I would like to pass "checked" with cars_path URL (call index)
end
如何通過這種「檢查」變量用cars_path這樣在我的索引函數中我可以得到它? (cars_path調用指數功能)
def index
checked = params[checked]
end
看看這個:http://stackoverflow.com/questions/1430247/passing-parameters-in-rails-redirect -至 – kafuchau 2011-02-03 14:29:24