Reputation: 15374
I am trying to render an image via paperclip like so in Active Admin
column "Images" do |m|
m.member_images.each do |img|
image_tag(img.photo.url(:thumb))
end
end
but in my view I get this rather than the image itself
[#<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">]
My Models are set up like so
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
Would there be any reason why the image would not show?
Upvotes: 0
Views: 453
Reputation: 15374
So after some more looking around on here i have found that this works
column "Images" do |m|
ul do
m.member_images.each do |img|
li do
image_tag(img.photo.url(:thumb))
end
end
end
end
Though i am not sure why this makes a difference
Upvotes: 1