Move the unique post key storage code into the Post model

This commit is contained in:
Neil Lalonde
2013-09-09 16:17:31 -04:00
parent 48ee89940e
commit 78c15d5810
4 changed files with 14 additions and 6 deletions

View File

@ -64,7 +64,7 @@ class Validators::PostValidator < ActiveModel::Validator
# If the post is empty, default to the validates_presence_of
return if post.raw.blank?
if $redis.exists(post.unique_post_key)
if post.matches_recent_post?
post.errors.add(:raw, I18n.t(:just_posted_that))
end
end