Permalink
Browse files

Fixing bug in groups controller where a deleted user would cause the …

…entire groups index to fail
  • Loading branch information...
1 parent 06ea578 commit f66ce916bdfab8238a2df1ad1a1784b3622abcfa cdubose committed Mar 28, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/controllers/admin/groups_controller.rb
View
2 app/controllers/admin/groups_controller.rb
@@ -23,7 +23,7 @@ def index
format.html
format.json {
@groups = @groups.map { |x| {:id => x.id, :name => x.name, :scope => x.scope, :lock_version => x.lock_version, # remapping these to get a group json that plays nice with EXT
- :owner => {:id => x.owner.id, :display_name => x.owner.display_name, :profile_path => user_profile_path(x.owner) }, :group_path => admin_group_path(x)}} unless @groups.empty?
+ :owner => x.owner.nil? ? {} : {:id => x.owner.id, :display_name => x.owner.display_name, :profile_path => user_profile_path(x.owner) }, :group_path => admin_group_path(x)}} unless @groups.empty?
render :json => { :groups => @groups, :count => groups.length, :page => page.to_i, :per_page => 10, :start => params[:start].to_i }
}
end

0 comments on commit f66ce91

Please sign in to comment.