2008-04-25 18:23:48 -04:00
|
|
|
class Reference < ActiveRecord::Base
|
|
|
|
belongs_to :person
|
|
|
|
belongs_to :job
|
2010-10-31 07:21:28 -04:00
|
|
|
|
2010-10-09 17:00:33 -04:00
|
|
|
has_many :agents_posts_authors, :through => :person
|
2011-03-02 16:24:56 -05:00
|
|
|
|
2012-11-19 09:52:09 -05:00
|
|
|
class << self; attr_accessor :make_comments; end
|
|
|
|
self.make_comments = false
|
2011-02-01 17:56:04 -05:00
|
|
|
|
|
|
|
before_destroy :make_comments
|
|
|
|
|
|
|
|
def make_comments
|
|
|
|
if self.class.make_comments
|
2013-01-02 11:46:58 -05:00
|
|
|
person.update comments: "Reference destroyed"
|
2011-02-01 17:56:04 -05:00
|
|
|
end
|
|
|
|
end
|
2008-04-25 18:23:48 -04:00
|
|
|
end
|
2010-07-19 21:26:57 -04:00
|
|
|
|
|
|
|
class BadReference < ActiveRecord::Base
|
2011-04-03 19:07:45 -04:00
|
|
|
self.table_name = 'references'
|
2012-03-21 18:18:18 -04:00
|
|
|
default_scope { where(:favourite => false) }
|
2010-07-19 21:26:57 -04:00
|
|
|
end
|