Question

I'm looking for a easy way to have multiple attachments on one model using Rails Admin. I've already Paperclip working, but I need multiple images and not just one.

Any hints / ideas / links?

Thank you very much!

Ole

Was it helpful?

Solution

Let's say that you have a user who wants many photos:

class User
  has_many :photos
end

class Photo
  belongs_to :user
  has_attached_file :image
  #or
  mount :image, ImageUploader
end

So you don't ask your carrierwave or paperclip model to have multiple files, you instead have many paperclip models belonging to your rails model.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top