我們的代碼看起來像磨回形針運行回形針4.1時沒有validates_attachment_file_name:升級到3.5
has_merchants_attached_file :pdf,
storage: :s3,
s3_credentials: Mbc::DataStore.s3_credentials,
s3_permissions: :private,
path: ":identifier_template.pdf",
bucket: Mbc::DataStore.forms_and_templates_bucket_name
validates_attachment_file_name :pdf, :matches => [/pdf\Z/]
產生一個錯誤:有趣的是
undefined method `validates_attachment_file_name' for #<Class:0x007fba67d25fe0>
,當我們倒等級回到3.5,我們遇到同樣的問題。
正在生成這個控制器是:
def index
@fidelity_templates = FidelityTemplate.order("identifier asc").all
end
此外:
def has_merchants_attached_file(attribute, options={})
if Rails.env.test? || Rails.env.development?
has_attached_file attribute,
path: "paperclip_attachments/#{options[:path]}"
else
has_attached_file attribute, options
end
end
什麼可能會導致這有什麼想法?
「has_merchants_attached_file」是什麼意思?這是你自己的方法嗎?如果是,請分享一下。 –
@KirtiThorat。不,我沒有。它來自下面提到的文檔。 –
你指的是哪些文件?你能指出一下嗎? –