Hi,
I have an error on rails 4.2 using the gem carrierwave-crop 0.1.2.
when I try to crop the image an error occurs:
NoMethodError (undefined method `crop' for #LocationShowcaseUploader::Uploader70164076328740:0x007fa0b6842a98)
my code:
class LocationShowcase < ActiveRecord::Base
# other stuff..
mount_uploader :image, LocationShowcaseUploader, mount_on: :image_file_name
crop_uploaded :image
# other stuff..
end
class LocationShowcaseUploader < CarrierWave::Uploader::Base
include CarrierWave::Compatibility::Paperclip
include SharedUploader
include CarrierWave::MiniMagick
include CarrierWave::ImageOptimizer
# other stuff..
version :default do
process resize_to_fit: [600, -1], optimize: [{ quality: 60 }]
end
version :large, if: :is_cropped? do
process crop: :default
process resize_to_fit: [1335, -1], optimize: [{ quality: 60 }]
end
version :medium, if: :is_cropped? do
process crop: :default
process resize_to_fit: [770, -1], optimize: [{ quality: 60 }]
end
version :small, if: :is_cropped? do
process crop: :default
process resize_to_fit: [610, -1], optimize: [{ quality: 60 }]
end
version :admin, if: :is_cropped? do
process crop: :default
process resize_to_fit: [-1, 70], optimize: [{ quality: 60 }]
end
private
def is_cropped?(image)
model.image_crop_x.present?
end
end
Maybe too late to the party but I had the same problem. Noticed had gem "carrierwave-crop" before gem "carrierwave" inside my Gemfile. Changed the order, did bundle install and the error disappeared.
Hi, I have an error on rails 4.2 using the gem carrierwave-crop 0.1.2. when I try to crop the image an error occurs:
NoMethodError (undefined method `crop' for #LocationShowcaseUploader::Uploader70164076328740:0x007fa0b6842a98)
my code: