的意見/輛/ _form.html.haml如何從變量傳遞變量到控制器動作?
= link_to "Deactivate", "/vehicles/deactivate"
我想在@vehicle通過我的link_to以上。 我該怎麼做?
控制器/ vehicles_controller.rb
def deactivate
@vehicle = Vehicle.find(params[:id])
@vehicle.active = 0
@vehicle.save
respond_to do |format|
format.html { redirect_to vehicles_url }
format.json { head :no_content }
end
end