Jan
Jan

Reputation: 6848

Carrierwave: how to handle multiple uploads of the same type

currently I am having an Article 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.

Upvotes: 0

Views: 680

Answers (1)

Srdjan Pejic
Srdjan Pejic

Reputation: 8202

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.

Upvotes: 1

Related Questions