プロジェクト

全般

プロフィール

Vote #79170

未完了

Consistent interface for Principal.member_of and not_member_of

Admin Redmine さんがほぼ2年前に追加.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
-
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
0
version_id:
0
issue_org_id:
28243
author_id:
4
assigned_to_id:
0
comments:
0
status_id:
1
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

Principal model has the following two scopes: member_of and not_member_of, both of them expect project or collection of projects as an argument. The problem is that given

projects = Project.where(:name => 'My Project')
you'll get correct results from
Principal.member_of(projects)
, but an exception will be thrown if you'll try to run
Principal.not_member_of(projects)
. That's because not_member_of puts its argument into an array if it's not a subclass of Array (which Project::ActiveRecord_Relation is not, though it knows how to #map).

I think one should be able to call both member_of and not_member_of with any kind of project collection, not just Array, and both of them should process arguments in the same way. So I provide a patch for that.

表示するデータがありません

他の形式にエクスポート: Atom PDF

いいね!0