lib/rails-canhaz/extensions_subject.rb in rails-canhaz-1.0.4 vs lib/rails-canhaz/extensions_subject.rb in rails-canhaz-1.0.5

- old
+ new

@@ -64,10 +64,10 @@ # # @param type [Class] The type of the objects # @param permission [String, Symbol] The name of the permission # @return The macthing objects in an array def objects_with_permission(type, permission) - type.joins("INNER JOIN can_haz_permissions ON can_haz_permissions.cobject_id = #{type.table_name}.id").where('cobject_type = ?', type.to_s).where('permission_name = ?', permission) + type.joins("INNER JOIN can_haz_permissions ON can_haz_permissions.cobject_id = #{type.table_name}.id").where('cobject_type = ? AND csubject_id = ?', type.to_s, self.id).where('permission_name = ?', permission) end def canhaz_subject? true end