forum post votes: add index page.
This commit is contained in:
@@ -8,6 +8,12 @@ class ForumPostVote < ApplicationRecord
|
||||
scope :by, ->(user_id) {where(creator_id: user_id)}
|
||||
scope :excluding_user, ->(user_id) {where("creator_id <> ?", user_id)}
|
||||
|
||||
def self.search(params)
|
||||
q = super
|
||||
q = q.search_attributes(params, :creator, :forum_post_id, :score)
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
|
||||
def up?
|
||||
score == 1
|
||||
end
|
||||
|
||||
@@ -91,6 +91,7 @@ class User < ApplicationRecord
|
||||
has_many :comments, foreign_key: :creator_id
|
||||
has_many :wiki_page_versions, foreign_key: :updater_id
|
||||
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
|
||||
has_many :forum_post_votes, dependent: :destroy, foreign_key: :creator_id
|
||||
has_many :posts, :foreign_key => "uploader_id"
|
||||
has_many :post_appeals, foreign_key: :creator_id
|
||||
has_many :post_approvals, :dependent => :destroy
|
||||
|
||||
Reference in New Issue
Block a user