![](/img/trans.png)
[英]Rails, Heroku, Cloudinary: Photos not uploading to cloudinary in production, although working locally
[英]Cloudinary reverse photos order after create/update on production
我正在使用cloud和附屬寶石上傳將在旋轉木馬上展出的照片,這對我來說很重要。
更新:
發生的事情是,當我們打電話時:
product = Product.find(id)
product.photo.count # it returns many photos from attachinary
> 12
first_photo = product.photo.first
在生產中:
first_photo
返回最后創建的照片(更大的ID號) 在開發/分期中:
first_photo
返回創建的第一張照片(較小的ID號) Atachinary創建此表:
create_table "attachinary_files", force: :cascade do |t|
t.string "attachinariable_type"
t.integer "attachinariable_id"
t.string "scope"
t.string "public_id"
t.string "version"
t.integer "width"
t.integer "height"
t.string "format"
t.string "resource_type"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["attachinariable_type", "attachinariable_id", "scope"], name: "by_scoped_parent", using: :btree
end
眼鏡:
表
Product.rb
has_attachments :photo, maximum: 20, accept: [:jpg, :jpeg, :jfif, :bmg, :bpg, :png]
我們可以通過在我們需要顯示照片的所有時間添加id來進行轉換。 在產品#edit視圖中,我們可以看到在我的情況下,附加順序的小圖片在生產中仍然“反轉”,但我認為這不是一個主要問題,因為我們有id來跟蹤正確的順序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.