I know that model should not be aware of session data but I have a need to access a small bit of state information in the method_missing that is defined on a model. Methods caught by method_missing are invoked by form helpers, i.e.:
client_medias/new.haml:
f.text_field :new_display_name
client_media.rb:
has_many :custom_properties, :as => :extensible
Here 'new_display_name' is a custom property key defined through a polymorphic association. I need to know the context (in my case provided by current_app method accessible in the controller) to get the collection of distinct custom property keys which I am mapping to the dynamic method definitions in method_missing.
Any ideas? I looked into Thread.current and am inclined to use it at this moment.