If I instantiate a class and set an instance variable in a Ruby module used by a Rails controller or model, how long does that instance variable persist? Does a variable nee
In Ruby on Rails, it always depends on the scope and where it's defined.
For example, objects/instance variables defined in your environment and configuration files, will persist always. A simple example of this is ActiveMerchant payment gateways, which are defined in the environment.rb file and are present for every request.
In case of controllers, it present for that HTTP request alone, the object and the instance variables.