* Added note version controller and test
* Added pool version controller and test * Refactored unit tests for post disapprovals * Renamed PostModerationDetail to PostDisapproval
This commit is contained in:
11
app/models/post_disapproval.rb
Normal file
11
app/models/post_disapproval.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class PostDisapproval < ActiveRecord::Base
|
||||
belongs_to :post
|
||||
belongs_to :user
|
||||
validates_uniqueness_of :post_id, :scope => [:user_id]
|
||||
|
||||
def self.prune!
|
||||
joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE").select("post_disapprovals.*").each do |post_disapproval|
|
||||
post_disapproval.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user