Note that there are some explanatory texts on larger screens.

plurals
  1. PORails3 and Paperclip
    text
    copied!<p>I have migrated my application from rails 2.3 to rails3 and i have a problem with paperclip. I saw there was a branch for rails3 on paperclip git.</p> <p>So I added "gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :branch => 'rails3'" into the Gemfile and launch the command bundle install.</p> <p>Once paperclip installed, the upload worked fine but not the styles. I saw a hack to fix it.</p> <pre><code># in lib/paperclip/attachment.rb at line 293 def callback which #:nodoc: # replace this line... # instance.run_callbacks(which, @queued_for_write){|result,obj| result == false } # with this: instance.run_callbacks(which, @queued_for_write) end </code></pre> <p>The styles are ok after that, but i'm not able to active the processor. My code is : </p> <pre><code>has_attached_file :image, :default_url =&gt; "/images/nopicture.jpg", :styles =&gt; { :large =&gt; "800x600&gt;", :cropped =&gt; Proc.new { |instance| "#{instance.width}x#{instance.height}&gt;" }, :crop =&gt; "300x300&gt;" }, :processors =&gt; [:cropper] </code></pre> <p>My processor is located in RAILS_APP/lib/paperclip_processors/cropper.rb and contains : </p> <pre><code>module Paperclip class Cropper &lt; Thumbnail def transformation_command if crop_command and !skip_crop? crop_command + super.sub(/ -crop \S+/, '') else super end end def crop_command target = @attachment.instance trans = ""; trans &lt;&lt; " -crop #{target.crop_w}x#{target.crop_h}+#{target.crop_x}+#{target.crop_y}" if target.cropping? trans &lt;&lt; " -resize \"#{target.width}x#{target.height}\"" trans end def skip_crop? ["800x600&gt;", "300x300&gt;"].include?(@target_geometry.to_s) end end end </code></pre> <p>My problem is that i got this error message : uninitialized constant Paperclip::Cropper The cropped processor is not loaded.</p> <p>Is anybody has an idea to fix that ?</p> <p>For information my application works fine on rails 2.3.4.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload