Sha256: 3f0db54a30ba526c6f6bc7437e6294ea8b1549184fc3ee35948b6fc4259bf5ba

Contents?: true

Size: 746 Bytes

Versions: 6

Compression:

Stored size: 746 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

6 entries across 6 versions & 2 rubygems

Version Path
ibm_db-5.5.0 test/models/reader.rb
ibm_db-5.4.1 test/models/reader.rb
ibm_db-5.4.0 test/models/reader.rb
ibm_db-5.3.2 test/models/reader.rb
ibm_db-5.3.1 test/models/reader.rb
ruby-on-quails-0.1.0 activerecord/test/models/reader.rb