added post voting

This commit is contained in:
albert
2010-02-15 17:45:09 -05:00
parent 80f033f253
commit 9f353c32f4
10 changed files with 112 additions and 19 deletions

View File

@@ -14,10 +14,6 @@ class User < ActiveRecord::Base
after_save :update_cache
scope :named, lambda {|name| where(["lower(name) = ?", name])}
def can_update?(object, foreign_key = :user_id)
is_moderator? || is_admin? || object.__send__(foreign_key) == id
end
module NameMethods
module ClassMethods
def find_name(user_id)
@@ -100,5 +96,9 @@ class User < ActiveRecord::Base
include PasswordMethods
extend AuthenticationMethods
include FavoriteMethods
def can_update?(object, foreign_key = :user_id)
is_moderator? || is_admin? || object.__send__(foreign_key) == id
end
end