I have a self-associating model which allows the user to define a "parent photo", in order to group them together.
My model:
class Photo < ActiveRecord::Base
attr_accessible :image, :parent_photo
has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }
validates_attachment :image,
:presence => true,
:size => { :in => 20..2000.kilobytes },
:content_type => { :content_type => [ 'image/jpeg', 'image/png' ] }
belongs_to :parent, class_name: "Photo", foreign_key: :parent_photo
def associated_photos
Photo.find_by_parent_photo(id)
end
end
And in my rails_admin initializer:
..
config.model Photo do
list do
field :image
field :associated_photos
end
end
end
How do I retrieve the actual thumbnail for use in the list action?
.image
instead of.image.url
). Thanks! – Marque