2006-02-10 01:53:34 -05:00
|
|
|
class Reader < ActiveRecord::Base
|
|
|
|
belongs_to :post
|
2016-08-06 13:37:57 -04:00
|
|
|
belongs_to :person, inverse_of: :readers
|
|
|
|
belongs_to :single_person, class_name: "Person", foreign_key: :person_id, inverse_of: :reader
|
2013-01-27 15:31:01 -05:00
|
|
|
belongs_to :first_post, -> { where(id: [2, 3]) }
|
2006-02-10 01:53:34 -05:00
|
|
|
end
|
2012-03-05 15:00:48 -05:00
|
|
|
|
|
|
|
class SecureReader < ActiveRecord::Base
|
|
|
|
self.table_name = "readers"
|
|
|
|
|
2016-08-06 13:37:57 -04:00
|
|
|
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"
|
2012-03-05 15:00:48 -05:00
|
|
|
end
|
2012-08-28 15:48:59 -04:00
|
|
|
|
|
|
|
class LazyReader < ActiveRecord::Base
|
|
|
|
self.table_name = "readers"
|
|
|
|
default_scope -> { where(skimmer: true) }
|
|
|
|
|
2016-08-06 13:37:57 -04:00
|
|
|
scope :skimmers_or_not, -> { unscope(where: :skimmer) }
|
2012-08-28 15:48:59 -04:00
|
|
|
|
|
|
|
belongs_to :post
|
|
|
|
belongs_to :person
|
|
|
|
end
|