Carrierwave: how to handle multiple uploads of the same type
currently I am having an Art开发者_如何学JAVAicle model with one carrierwave uploader, requirements have changed and every Article should have n images attached.
What is the best (and most simple) way to achieve this? Right now, all I can think of is creating an Image entity and have this reference the uploader and let have every Article n Images. Sounds like a lot of work and would break all current images, so I would not favor this.
It might be better if you do split out the image uploading requirements into its own model. Your Article model has already changed the requirements and you might have other models needing similar functionality later on.
From the software design point of view, having an Image model that deals with uploading and relating that to an Article model is a more maintainable way.
精彩评论