enter code here
I am currently revamping old system which was built in rails 3 and ruby-1.9.3 to rails 7.1.3.2 and ruby-3.3.0. Now in my old app, it was using paperclip for all attachments so I will also be using paperclip in my new app. In my old app, all validations work like content type and size but I am having trouble working with validations in rails 7 which my new app is using.
This is my model code.
class User < ApplicationRecord
base_url = "/home/muhammadans41/Downloads/paperclip/comments/:id/:style/:basename.:extension"
base_path = "/home/muhammadans41/Downloads/paperclip/comments/:id/:style/:basename.:extension"
has_attached_file :avatar, storage: :filesystem, styles: { small: "264x204>", large: "800x800>"}, path: "#{base_path}", url: "#{base_url}"
validates_attachment_content_type :avatar, content_type: ["image/jpeg", "image/jpg", "application/pdf"]
validates_attachment_size :avatar, :less_than => 2.megabytes
end