I just started using paperclip and have a custom processor. I have put the new processor in the correct location RAILS_ROOT/lib/paperclip_processors
But, it does not get loaded.
The reason for not loading, is that Rails.root
is nil at the time paperclip
is loaded. I've tested this by putting explicit code into the paperclip.rb
puts "What is Rails.root? #{Rails.root} #{Rails.root.nil?}"
if defined?(Rails.root) && Rails.root
Dir.glob(File.join(File.expand_path(Rails.root), "lib", "paperclip_processors", "*.rb")).each do |processor|
require processor
end
end
Which will print out What is Rails.root true
. And the processors are never load.
Is there a fix or work around for this? The work around right now is to just add a require for our processor. but that doesn't seem right.