1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/models/reference.rb

23 lines
493 B
Ruby
Raw Normal View History

class Reference < ActiveRecord::Base
belongs_to :person
belongs_to :job
2010-10-31 07:21:28 -04: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'
default_scope { where(:favourite => false) }
end