Sha256: 5a4a55c09b9061fb1f9aa5ec56d56e3af68c2de11396fe7ecdf5ee45b6acab82

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

class Reader < ActiveRecord::Base
  belongs_to :post
  belongs_to :person, inverse_of: :readers
  belongs_to :single_person, class_name: "Person", foreign_key: :person_id, inverse_of: :reader
  belongs_to :first_post, -> { where(id: [2, 3]) }
end

class SecureReader < ActiveRecord::Base
  self.table_name = "readers"

  belongs_to :secure_post, class_name: "Post", foreign_key: "post_id"
  belongs_to :secure_person, inverse_of: :secure_readers, class_name: "Person", foreign_key: "person_id"
end

class LazyReader < ActiveRecord::Base
  self.table_name = "readers"
  default_scope -> { where(skimmer: true) }

  scope :skimmers_or_not, -> { unscope(where: :skimmer) }

  belongs_to :post
  belongs_to :person
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ibm_db-5.5.0-x86-mingw32 test/models/reader.rb
ibm_db-5.4.1-x86-mingw32 test/models/reader.rb
ibm_db-5.4.0-x86-mingw32 test/models/reader.rb
ibm_db-5.3.2-x86-mingw32 test/models/reader.rb