rails/activerecord/test/models/reference.rb

26 lines
594 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Reference < ActiveRecord::Base
belongs_to :person
belongs_to :job
2010-10-31 11:21:28 +00:00
has_many :ideal_jobs, class_name: "Job", foreign_key: :ideal_reference_id
2016-08-06 17:37:57 +00:00
has_many :agents_posts_authors, through: :person
class << self; attr_accessor :make_comments; end
self.make_comments = false
before_destroy :make_comments
def make_comments
if self.class.make_comments
person.update comments: "Reference destroyed"
end
end
end
class BadReference < ActiveRecord::Base
self.table_name = "references"
2016-08-06 17:37:57 +00:00
default_scope { where(favourite: false) }
end