user model save bug

This commit is contained in:
yanxd 2014-06-04 10:08:54 +08:00
parent 3a80a80841
commit 51bfb6cae8
2 changed files with 39 additions and 41 deletions

View File

@ -86,8 +86,6 @@ class User < Principal
## added by xianbo for delete
has_many :biding_projects, :dependent => :destroy
has_many :contesting_projects, :dependent => :destroy
has_many :contesting_softapplications, :dependent => :destroy
has_many :projecting_softapplications, :dependent => :destroy
belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy
##ended by xianbo
@ -203,14 +201,14 @@ class User < Principal
# ======================================================================
# 集中处理 User 扩展表为空的问题
validate :valid_user_extensions
before_save :save_user_extensions
after_save :save_user_extensions
def extensions
self.user_extensions ||= self.create_user_extensions
self.user_extensions ||= UserExtensions.new
end
def respond_to?(m, include_private = false)
flag = extensions.respond_to? m.to_sym
flag = UserExtensions.instance_methods.include? m.to_sym
if flag
flag
else