Sha256: 19e33ab742c330e5e74461b9cc639a4e8b660ad5140a3f595004ce5ace72b688

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

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

  has_many :ideal_jobs, class_name: "Job", foreign_key: :ideal_reference_id
  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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ibm_db-5.5.0 test/models/reference.rb
ibm_db-5.4.1 test/models/reference.rb
ibm_db-5.4.0 test/models/reference.rb
ibm_db-5.3.2 test/models/reference.rb
ibm_db-5.3.1 test/models/reference.rb