好吧,我有这个问题
我的模型服务中有这个
class Service < ApplicationRecord
belongs_to :user
has_attached_file :images, :styles => {:md => "300x300>", :large => "500x500>" , :xl => "700x700#"}, :default_url => "/app/assets/images/thumb/missing.png"
validates_attachment_content_type :images, :content_type => /Aimage/.*Z/
end
在我看来,服务#索引
<div>
<%= image_tag service.images(:md)%>
</div>
但是当我输入 :large 或 :XL 时,我的视图图像集存在问题,但当我放置 :md 时,图像不显示。 我不知道发生了什么
如果您在索引视图中将其替换为:md
时:large
和:xl
正常工作,那么我猜根本没有可供:md
显示的版本。在实际上传图像后,您是否向模型添加了:md
?我会删除图像并重试。