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

@@ -1,6 +1,7 @@
class ModAction < ActiveRecord::Base
belongs_to :creator, :class_name => "User"
before_validation :initialize_creator, :on => :create
default_scope limit(1)
def initialize_creator
self.creator_id = CurrentUser.id