GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: This plugin provides a flexible way to add authorization to Rails.
Homepage: http://www.writertopia.com/developers/authorization
Clone URL: git://github.com/DocSavage/rails-authorization-plugin.git
authorizables_for performance improvement
lawrencepit (author)
Thu Jun 19 02:23:46 -0700 2008
commit  c0603015ddb30cda1143ef77105c50e4f5593435
tree    e0fa566b3e0785362cac9129650ec4169f426c51
parent  e98a887e22f0a56a9cffa1f2dd7328eff67f8b9d
...
75
76
77
78
79
80
81
82
83
84
 
 
 
85
86
87
...
75
76
77
 
 
 
 
 
 
 
78
79
80
81
82
83
0
@@ -75,13 +75,9 @@ module Authorization
0
           unless authorizable_class.is_a? Class
0
             raise CannotGetAuthorizables, "Invalid argument: '#{authorizable_class}'. You must provide a class here."
0
           end
0
- authorizables = self.roles.inject([]) do |result, role|
0
- if role.authorizable_type == authorizable_class.to_s && !result.include?(role.authorizable)
0
- result << role.authorizable
0
- end
0
- result
0
- end
0
- authorizables.compact
0
+ authorizable_class.find(
0
+ self.roles.find_all_by_authorizable_type(authorizable_class.base_class.to_s).map(&:authorizable_id).uniq
0
+ )
0
         end
0
 
0
         private

Comments

    No one has commented yet.