Fixed bug in ApplicationController#get_owner

This commit is contained in:
George Vinogradov 2011-12-07 16:32:42 +04:00
parent 0f827f2644
commit 0d9b683100
1 changed files with 8 additions and 3 deletions

View File

@ -17,10 +17,15 @@ class ApplicationController < ActionController::Base
def get_owner def get_owner
# params['user_id'] && User.find_by_id(params['user_id']) || # params['user_id'] && User.find_by_id(params['user_id']) ||
# params['group_id'] && Group.find_by_id(params['group_id']) || current_user # params['group_id'] && Group.find_by_id(params['group_id']) || current_user
if parent and (parent.is_a? User or parent.is_a? Group) if self.class.method_defined? :parent
parent if parent and (parent.is_a? User or parent.is_a? Group)
return parent
else
return current_user
end
else else
current_user params['user_id'] && User.find_by_id(params['user_id']) ||
params['group_id'] && Group.find_by_id(params['group_id']) || current_user
end end
end end