Processor not loading at first try with Rails3

Skip to first unread message

Alejandro Riera

Sep 16, 2010, 1:48:22 PM9/16/10
to Paperclip Plugin

I'm having an issue when loading a processor for cropping images. The
first time it is called it breaks with this message:
[paperclip] An error was received while processing:
#<Paperclip::PaperclipError: Processor Jcropper was not found>
the following times it is used there is no problem, it works without

My box has paperclip 2.3.3 revision 9e6afe4 (according to my
Gemfile.lock) and rails 3.0.0 installed.

My processor (jcropper.rb) is located in lib/paperclip_processors and
I have put that path in the autoload paths in application.rb
[config.autoload_paths += %W(#{config.root}/lib/
paperclip_processors) ].

My guess is that gems/processors/models/dont-know-what-else are not
being required in the correct order, but I dont know which one it
might be and dont knowhow to face this problem, so I will thank any
help here : )

Just to clarify, the process is as follows:
1. Start webrick (OK)
2. Upload a photo (OK)
3. Crop that photo (ERROR)
4. Upload another photo (OK)
5. Crop that photo (OK)
repeat 4 and 5 and it will always work (until you stop the server and
relaunch it)

Thanks in advance,


Alejandro Riera

Sep 17, 2010, 12:53:01 PM9/17/10
to Paperclip Plugin
Apparently the problem is that paperclip [1] has this code

    if defined?(Rails.root) && Rails.root
      Dir.glob(File.join(File.expand_path(Rails.root), "lib", "paperclip_processors", "*.rb")).each do |processor|
        require processor

When bundler loads gems for the first time rails is not already loaded, so `Rails.root` won't be defined and paperclip won't require the processors.

My solution is quite ugly: I installed paperclip as a plugin and edited that file to manually require my processor like this:
require 'lib/paperclip_processors/jcropper'

Not the prettiest solution, but will fix the problem until the problem is properly addressed.




Individuals over processes. Interactions over tools.

Agile Rails training from thoughtbot, the makers of Paperclip, Clearance, Shoulda, & Factory Girl:

The Paperclip group:

To post to this group, send email to

To unsubscribe from this group, send email to

In the game of chess you can never let your adversary see your pieces.

Christian Fazzini

Oct 1, 2010, 5:47:34 AM10/1/10
to Paperclip Plugin
Hi Alex, I too am getting the same problem in Rails 3. Seems like
paperclip is not recognising the processor option in rails 3....

Its been a few days, do you have a better fix now?
> ><>


Oct 1, 2010, 12:16:12 PM10/1/10
to Paperclip Plugin
I am curious if another solution has been found for this?

Christian Fazzini

Oct 1, 2010, 1:32:09 PM10/1/10
to Paperclip Plugin
So far, I have found this. I put it in application.rb

# Needed for paperclip:
# The documentation states that custom processors that inherit
from Paperclip::Processor will be loaded
# automatically if placed in lib/paperclip_processors. But in
Rails 3, this isn't the case.
# This issue is caused by the Paperclip gem being loaded before
the Rails object is properly configured.
# Needs to be fixed properly in Paperclip itself.
config.after_initialize do

# copied from paperclip.rb: due to bundler, this doesn't seem to
happen automagically anymore!?!
Dir.glob(File.join(File.expand_path(Rails.root), "lib",
"paperclip_processors", "*.rb")).each do |processor|
require processor # PVDB don't rescue LoadError... let it rip!



Oct 1, 2010, 5:58:44 PM10/1/10
to Paperclip Plugin
Try sticking the cropper processor file inside /config/initializer

On Oct 1, 10:32 am, Christian Fazzini <>

Christian Fazzini

Oct 2, 2010, 8:42:43 AM10/2/10
to Paperclip Plugin
jrs, is that how it is supposed to be though? or is this a temp
solution until paperclip gets it fixed?
Reply all
Reply to author
0 new messages