create redmine plugin
-
01-06-2021 - |
Question
I am creating a Redmine plug in for message system. For that I have created a model with name "communication.rb". here I want to create the Activerecord relationship between Communication model and User model(here User model already existing).
in user.rb
has_many :communications
in communication.rb
belongs_to :user
How could I create relationship with existing model while creating plug in
Solution
Try add somewhere in you plugin:
User.class_eval do
has_many :communications
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow