Class: Vote
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Vote
- Defined in:
- app/models/vote.rb
Overview
== Schema Information
Table name: votes
Database name: primary
id :bigint not null, primary key
resource_type :string
value :integer
customer_id :integer
resource_id :integer
Indexes
by_rid_rt_cid (resource_id,resource_type,customer_id)
idx_customer_id_resource_type (customer_id,resource_type)
Belongs to collapse
Class Method Summary collapse
-
.negative ⇒ ActiveRecord::Relation<Vote>
A relation of Votes that are negative.
-
.positive ⇒ ActiveRecord::Relation<Vote>
A relation of Votes that are positive.
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.negative ⇒ ActiveRecord::Relation<Vote>
A relation of Votes that are negative. Active Record Scope
22 |
# File 'app/models/vote.rb', line 22 scope :negative, -> { where('value < 0') } |
.positive ⇒ ActiveRecord::Relation<Vote>
A relation of Votes that are positive. Active Record Scope
21 |
# File 'app/models/vote.rb', line 21 scope :positive, -> { where('value > 0') } |
Instance Method Details
#resource ⇒ Resource
19 |
# File 'app/models/vote.rb', line 19 belongs_to :resource, polymorphic: true, optional: true |