* Continued work on improving post view templates
* Added statistics-based estimator for related tag calculator * Fleshed out IpBan class based on changes to Danbooru 1.xx
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
class PostVote < ActiveRecord::Base
|
||||
class Error < Exception ; end
|
||||
|
||||
attr_accessor :is_positive
|
||||
validates_uniqueness_of :ip_addr, :scope => :post_id
|
||||
after_save :update_post_score
|
||||
belongs_to :post
|
||||
|
||||
def update_post_score
|
||||
if is_positive
|
||||
post.increment!(:score)
|
||||
else
|
||||
post.decrement!(:score)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user