I've inherited a database and am trying to make sense of the associations.
In my Agent model:
class Agent < ActiveRecord::Base
has_many :created_events, :class_name => "Event", :as => :creator
has_many :created_tasks, :class_name => "Task", :as => :creator
....
end
In my Event model:
class Event < ActiveRecord::Base
belongs_to :creator, :class_name => 'Agent'
....
end
In my Task model: class Task < ActiveRecord::Base belongs_to :creator, :class_name => 'Agent' ... end
What type of association is this? What is it doing?
In my research, all of the examples either use polymorphic: :true
- for polymorphic associations, or foreign_key:
- to set the foreign key directly. Neither of these association options are present in any of my models.
Aucun commentaire:
Enregistrer un commentaire