2017-07-09 17:41:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2008-04-25 22:23:48 +00:00
|
|
|
class Reference < ActiveRecord::Base
|
|
|
|
belongs_to :person
|
|
|
|
belongs_to :job
|
2010-10-31 11:21:28 +00:00
|
|
|
|
2017-07-21 03:26:09 +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
|
2011-03-02 21:24:56 +00:00
|
|
|
|
2012-11-19 14:52:09 +00:00
|
|
|
class << self; attr_accessor :make_comments; end
|
|
|
|
self.make_comments = false
|
2011-02-01 22:56:04 +00:00
|
|
|
|
|
|
|
before_destroy :make_comments
|
|
|
|
|
|
|
|
def make_comments
|
|
|
|
if self.class.make_comments
|
2013-01-02 16:46:58 +00:00
|
|
|
person.update comments: "Reference destroyed"
|
2011-02-01 22:56:04 +00:00
|
|
|
end
|
|
|
|
end
|
2008-04-25 22:23:48 +00:00
|
|
|
end
|
2010-07-20 01:26:57 +00:00
|
|
|
|
|
|
|
class BadReference < ActiveRecord::Base
|
2016-08-06 16:26:20 +00:00
|
|
|
self.table_name = "references"
|
2021-04-12 02:35:12 +00:00
|
|
|
default_scope { where(favorite: false) }
|
2010-07-20 01:26:57 +00:00
|
|
|
end
|