سؤال

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

هل كانت مفيدة؟

المحلول

Try add somewhere in you plugin:

User.class_eval do
  has_many :communications
end
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top