views/vehicles/_form.html.haml
= link_to "Deactivate", "/vehicles/deactivate"
I want to pass in @vehicle in my link_to above. How do I do this?
controllers/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