2

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

Karthi Ponnusamy
  • 2,031
  • 2
  • 25
  • 41

1 Answers1

0

Try add somewhere in you plugin:

User.class_eval do
  has_many :communications
end
luacassus
  • 6,540
  • 2
  • 40
  • 58