Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Have other rights appear in groupless #5

Merged
merged 7 commits into from
Jul 6, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/right_on/right.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def by_groups
rights = []
rights += regular_rights_with_group
rights += restricted_rights_with_group
other_rights = Right.all - rights
other_rights.each { |right| right.group = 'Groupless' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just append the groupless rights to the end of the resulting array instead of introducing a hardcoded group name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe even clearer if we add a new method that just return the "groupless" rights.

rights += other_rights
rights.group_by(&:group)
end

Expand Down