Skip to content
This repository has been archived by the owner on Jul 31, 2022. It is now read-only.

Commit

Permalink
Catch exception for find in authorizable_for
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencepit committed Jun 19, 2008
1 parent c060301 commit 1fed21c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions authorization/lib/publishare/object_roles_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ def authorizables_for( authorizable_class )
unless authorizable_class.is_a? Class
raise CannotGetAuthorizables, "Invalid argument: '#{authorizable_class}'. You must provide a class here."
end
authorizable_class.find(
self.roles.find_all_by_authorizable_type(authorizable_class.base_class.to_s).map(&:authorizable_id).uniq
)
begin
authorizable_class.find(
self.roles.find_all_by_authorizable_type(authorizable_class.base_class.to_s).map(&:authorizable_id).uniq
)
rescue ActiveRecord::RecordNotFound
[]
end
end

private
Expand Down

0 comments on commit 1fed21c

Please sign in to comment.