fix post flag

This commit is contained in:
albert
2013-03-10 16:48:56 -04:00
parent 60e7ef536c
commit 6b02826405

View File

@@ -19,6 +19,10 @@ class PostFlag < ActiveRecord::Base
where("is_resolved = ?", false)
end
def recent
where("created_at >= ?", 1.day.ago)
end
def old
where("created_at <= ?", 3.days.ago)
end
@@ -50,8 +54,8 @@ class PostFlag < ActiveRecord::Base
end
def validate_creator_is_not_limited
if flag_count_for_creator >= 5
errors[:creator] << "can flag 5 posts a day"
if flag_count_for_creator >= 10
errors[:creator] << "can flag 10 posts a day"
false
else
true