exceptions are BAD

the old code wacked on 10ms to every home page request, for no real reason.
This commit is contained in:
Sam 2013-03-10 19:11:33 -07:00
parent a2facaa4d0
commit e62bb9922e
1 changed files with 2 additions and 2 deletions

View File

@ -501,9 +501,9 @@ class User < ActiveRecord::Base
end end
def add_trust_level def add_trust_level
# there is a possiblity we did no load trust level column, skip it
return unless attributes.key? "trust_level"
self.trust_level ||= SiteSetting.default_trust_level self.trust_level ||= SiteSetting.default_trust_level
rescue ActiveModel::MissingAttributeError
# Ignore it, safely - see http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/
end end
def update_username_lower def update_username_lower