1

I'm creating a plugin for Redmine. I want to use the core Issue model, but I want to include in it a relation with my model, which created in the plugin structure. How can I patch the Issue model for including a new relationship in my plugin?

Robin
  • 8,162
  • 7
  • 56
  • 101
jonua
  • 1,915
  • 3
  • 17
  • 27

2 Answers2

0

example with Project model

require 'project'

module ProjectPatch
  def self.included(base)
    base.has_one :project_settings
  end
end

Project.send :include, ProjectPatch
jonua
  • 1,915
  • 3
  • 17
  • 27
0

You can create a decorator in your main project to decorate the Issue model:

# app/decorators/issue_decorator.rb
Redmine::Issue.class_eval do
  has_many :blurps # or whatever your model is called
end
zwippie
  • 15,050
  • 3
  • 39
  • 54