title: How can a partial detect if it's being rendered by a mailer?
body: <p>I have a partial that is being shared between a few different views, and a mailer template.  This partial should attempt to use the user's session to store some state information if possible.</p>
  
  <p>Determining if the session exists seems to be a bit of a problem.  Within the partial, calling defined?(session) always seems to yield true during a mail render (is this a bug?), but attempting to access "session" in any way yields an "undefined method" exception.</p>
  
  <p>As of now, I'm having my mailer use a @for_mailer instance variable to signal this partial to render differently, but this doesn't seem very elegant.  Is there some simple way for the partial to figure out whether or not it's being rendered by a mailer, as opposed to being rendered in the context of a web request?</p>