title: Paperclip - dropbox. How can I setup a conditional has_attached_file?
body: <p>I am creating an application that lets users store data in their personal dropbox in a protected folder that the application controls. So each user needs to store and access files in their own personal dropbox account.</p>
  
  <p>To do this I'd like to leverage the paperclip-dropbox gem for storage. It allows paperclip to directly upload to dropbox: <a href="https://github.com/janko-m/paperclip-dropbox" rel="nofollow">https://github.com/janko-m/paperclip-dropbox</a>.</p>
  
  <p>Here is the code that sets the authorization information for the paperclip-dropbox gem. <strong>NOTE</strong>: current_user does not work at the moment. I'm just putting that there to outline what would need to happen for the current setup to work.</p>
  
  <p>Image.rb</p>
  
  <pre><code>has_attached_file :avatar,
                    :storage =&gt; :dropbox,
                    :dropbox_credentials =&gt; {app_key: DROPBOX_KEY,
                                             app_secret: DROPBOX_SECRET,
                                             access_token: current_user.token,
                                             access_secret: current_user.secret, 
                                             user_id: current_user.uid, 
                                             access_type: "app_folder"}
  </code></pre>
  
  <p>Notice the dropbox authentication requires the current_user to get that particular set of credentials. </p>
  
  <p>I know that the current_user is not supposed to be accessed from the model and I'd like to keep it that way so could anyone help me figure out how to do that with this current setup? Or suggest a better alternative?</p>
  
  <p>Basically, I need to conditionally change the access_token, access_secret, &amp; user_id on a per user basis. </p>
  
  <p>Thanks!</p>