add default scopes to every model

This commit is contained in:
albert
2013-01-07 17:12:43 -05:00
parent 257c0a081e
commit 040059c491
26 changed files with 40 additions and 19 deletions

View File

@@ -14,7 +14,8 @@ class Upload < ActiveRecord::Base
validate :uploader_is_not_limited
scope :uploaded_by, lambda {|user_id| where(["uploader_id = ?", user_id])}
scope :pending, where(:status => "pending")
default_scope limit(1)
module ValidationMethods
def uploader_is_not_limited
if !uploader.can_upload?