Sha256: b23ba2a03e73923a369f359a57b63e4018ee4bffca9e43ba023e499716c6d713

Contents?: true

Size: 518 Bytes

Versions: 1

Compression:

Stored size: 518 Bytes

Contents

# frozen_string_literal: true

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

  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

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activerecord/test/models/reference.rb