Establish a one-to-many relation to a Redmine core model

Added by Tudor Cornea almost 10 years ago


I am writing a plugin, and as a part of my project, I need to establish a one to many relation between a model created by me (ex: Upload), and a model that is part of the Redmine core ('attachments').

I know that the usual way to create this relation is by using "has_many :attachments" inside the "Upload" model ,and a "belongs_to :upload", inside the attachments, but this would involve modifying the core model "attachments", and it's out of discussion.

I need a way to create the relation which does not interfere with the core classes