Serving files over HTTPS dynamically based on request.ssl? with Attachment_fu
- by Marston A.
I see there is a :user_ssl option in attachment_fu which checks the amazon_s3.yml file in order to serve files via https://
In the s3_backend.rb you have this method:
    def self.protocol
      @protocol ||= s3_config[:use_ssl] ? 'https://' : 'http://'
    end
But this then makes it serve ALL s3 attachments with SSL. I'd like to make it dynamic depending if the current request was made with https:// i.e:
  if request.ssl?
    @protocol = "https://"
  else
    @protocol = "http://"  
  end
How can I make it work in this way? I've tried modifying the method and then get the NameError: undefined local variable or method `request' for Technoweenie::AttachmentFu::Backends::S3Backend:Module error