title: Rails, Heroku, Paperclip, S3 and cropping
body: <p>For my application I need a cropping functionality for images.
  I followed the railscast <a href="http://railscasts.com/episodes/182-cropping-images" rel="nofollow">http://railscasts.com/episodes/182-cropping-images</a></p>
  
  <p>Aaaall works fine on my local machine. I have my owm paperclip processor, which extends from the Thumbnail processor. This processor is stored under lib/paperclip_processors/cropper.rb</p>
  
  <pre><code>module Paperclip
    class Cropper &lt; Thumbnail
  
      def transformation_command
        if crop_command
          cmd = crop_command + super.join(" ").sub(/ -crop \S+/, '')
          cmd.split(" ")
        else
          super
        end
      end
  
      def crop_command
        target = @attachment.instance
        if target.cropping?
          " -crop \"#{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}\" "
        end
      end
    end
  end
  </code></pre>
  
  <p>On my local machine it uses this processor for cropping. On heroku it seems that this module is completely ignored.</p>
  
  <p>Yes, I searched around 6 hours for the solution... </p>
  
  <p>1.</p>
  
  <pre><code>#application.rb
  config.autoload_paths += %w(#{config.root}/lib)     
  #or 
  config.autoload_paths += Dir["#{config.root}/lib/**/"]
  #or
  config.autoload_paths += Dir["#{config.root}/lib/paperclip_processors/cropper.rb"]
  
  #all not working
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>#initializers/includes.rb
  require "cropper"
  
  #or
  
  Dir[Rails.root + 'lib/**/*.rb'].each do |file|
    require file
  end
  </code></pre>
  
  <p>Why the hell is my module not loading?? </p>