I have a view that can vary significantly depending on the "mode" that a particular user has selected.
I thought that I would extract the different behavior into two different helpers, and then the controller should have this code:
class MyController < ApplicationController case mode when 'mode1' helper "mode1" when 'mode2' helper "mode2" else raise "Invalid mode" end etc...
Once the correct helper is loaded, then an operator of the type <% = edit_item%>, which is defined in both helpers, will load the correct form for the particular "mode".
This works great in development, but in production, the case statement only runs once. Then you are stuck with any auxiliary was first loaded (Spirit, I should have known this.)
I thought of other ways to achieve what I need to do, but I still think that using helpers is a good clean way to change the behavior of a view.
Does anyone know how I can load (or reload) the helper at runtime?
TIA: John
source share