aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/models/reference.rb
blob: 06c4f79ef332d6a4ddd6c0e7ef4e0d788d283792 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15


                                    











                                                                 
   




                                                     
class Reference < ActiveRecord::Base
  belongs_to :person
  belongs_to :job

  class << self
    attr_accessor :make_comments
  end

  before_destroy :make_comments

  def make_comments
    if self.class.make_comments
      person.update_attributes :comments => "Reference destroyed"
    end
  end
end

class BadReference < ActiveRecord::Base
  self.table_name ='references'
  default_scope :conditions => {:favourite => false }
end