Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

[rails3] Custom Processors are not automatically loaded #247

Closed
kgautreaux opened this issue Jul 8, 2010 · 5 comments
Closed

[rails3] Custom Processors are not automatically loaded #247

kgautreaux opened this issue Jul 8, 2010 · 5 comments

Comments

@kgautreaux
Copy link

The documentation states that custom processors that inherit from Paperclip::Processor will be loaded automatically if placed in lib/paperclip_processors.

In rails 3.0.0.beta4 this doesn't work. The custom processor file is loaded if placed in Rails.root/config/initializers directory, but maybe the documentation should be changed to reflect this.

@pvdb
Copy link
Contributor

pvdb commented Jul 20, 2010

Hi Keith,

We ran into the same issue, but instead of sticking our custom Paperclip processors in Rails.root.join('config', 'initializers'), we worked around this issue as follows:

http://gist.github.com/482893

(which keeps the processors in the "standard" paperclip location) It does indeed appear though that this is something that needs to be fixed properly in Paperclip itself.

PS - based on our cursory investigation, this issue is caused by the Paperclip gem being loaded before the Rails object is properly configured... see the following snippet in the lib/paperclip.rb file

if defined?(Rails.root) && Rails.root
  # load custom Paperclip processors
end

@kgautreaux
Copy link
Author

Yes, your solution is certainly cleaner and agrees with the documentation as it stands now. Since (as I understand it) rails 3 loads gems as early as possible during app initialization maybe the loading code needs to be moved into application.rb permanently. It is more configuration but it could probably be reduced to a one-liner to call a class method in paperclip that loads the custom processors.

config.paperclip.custom_processors = :foo

No time to submit a patch so I guess this is a cry for help. :-)

@krzkrzkrz
Copy link

Am also experiencing this problem. Wondering if the paperclip team has fixed this issue already?

@ghost
Copy link

ghost commented Feb 15, 2011

Has there been any progress on this issue?

sikachu pushed a commit that referenced this issue Jun 20, 2011
In Rails 3, Paperclip gem being loaded before the Rails object is properly configured and causing those processors not get require'd. This patch should fix that by lazy-loaded the processor.

Closes #206, #233, #247, #480, #494
@sikachu
Copy link
Contributor

sikachu commented Jun 20, 2011

This has been fixed in [4e4f427]. Thank you :)

@sikachu sikachu closed this as completed Jun 20, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants