A device and a method for treating a medical condition include a reversible member disposed in a patients gastro-intestinal tract, and a dispensing member coupled to the reversible member that delivers a drug and/or a noxious when a predetermined substance is detected. In a different embodiment, the device and method of the present invention include a polymer infused with a drug and disposed into a preformed shell inside the gastric space, where it expands and hardens, releasing the drug over time. Both the casing and the polymer may be biocompatible. The present invention enables the slow-release of anti-addictive agents without patient tampering and with the appropriate dosage. Ancillary systems such as sensors, actuators, refill and recharge ports, and communication and data processing units may also be included.