Not doing so has a few gotchas when working with relations, particularly with records which are not stored in the database. I'm excluding the related content file because it's got a very peculiar relationship with itself: the `has_one :opposite_related_content` has no inverse; the relation itself is its inverse. It's a false positive since the inverse condition is true: ``` content.opposite_related_content.opposite_related_content.object_id == content.object_id ```
11 lines
336 B
Ruby
11 lines
336 B
Ruby
class Dashboard::ExecutedAction < ApplicationRecord
|
|
belongs_to :proposal
|
|
belongs_to :action
|
|
|
|
has_many :administrator_tasks, as: :source, inverse_of: :source, dependent: :destroy
|
|
|
|
validates :proposal, presence: true, uniqueness: { scope: :action }
|
|
validates :action, presence: true
|
|
validates :executed_at, presence: true
|
|
end
|