I created a new project with Rails 5.0.0 and Ruby 2.5 on my local mac with macOs 10.12. Now I'm trying to add paperclip to this project, but still no luck.
My model class is as follows:
class Photo < ApplicationRecord
has_attached_file :file, styles: { big: '1280x1024>', small: '640x480>' }
validates_attachment :file, content_type: { content_type: /\Aimage/ }, file_name: { matches: [/png\Z/i, /jpe?g\Z/i, /gif\Z/i] }, size: { less_than: 15.megabytes }
end
What version of paperclip I am trying, I don’t have a clip generator in my project, and I get errors like this when I try to call the model or its methods:
"NoMethodError (undefined method `has_attached_file' for Photo (call 'Photo.connection' to establish a connection):Class)"
When I add "include Paperclip :: Glue" as suggested here https://github.com/thoughtbot/paperclip/issues/705 the error changes to
NameError (uninitialized constant Photo::Paperclip)
Is there any way around this mess? > & L;
Link to paperclip issues
https://github.com/thoughtbot/paperclip/issues/2555
source
share