我正在尝试通过回形针在活动管理中提取图像
column "Images" do |m|
m.member_images.each do |img|
image_tag(img.photo.url(:thumb))
end
end
但在我看来,我得到的不是图像本身
[#<MemberImage id: 2, member_id: 2, created_at: "2014-02-18 21:37:27", updated_at: "2014-02-18 21:37:27", photo_file_name: "associations.jpg", photo_content_type: "image/jpeg", photo_file_size: 140780, photo_updated_at: "2014-02-18 21:37:27">]
我的模型设置如此
class MemberImage < ActiveRecord::Base
belongs_to :member
has_attached_file :photo, styles: { thumb: '100x100#' }
end
class Member < ActiveRecord::Base
has_many :member_images, dependent: :destroy
accepts_nested_attributes_for :member_images, allow_destroy: true
end
图像无法显示会有任何原因吗?
答案 0 :(得分:1)
所以经过一些更多的环顾四周,我发现这是有效的
column "Images" do |m|
ul do
m.member_images.each do |img|
li do
image_tag(img.photo.url(:thumb))
end
end
end
end
虽然我不确定为什么会有所作为