Files menu shortcuts

I am running into a problem with the shortcuts on the Files menu. If I use the code you have for creating a list of file shortcuts for groups all I get is the first group even though there are four groups in the projects variable. Below is what I have from the id command and the code I use to set up those paths:

uid=5012886(ros5549) gid=5012886(ros5549) groups=5012886(ros5549),11736861(dth5124_collab),11929814(ros5549_collab),11293892(admins-2e),12100219(mdg5396_collab),12158028(dsb10_collab),1000(allusers)

projects = User.new.groups.map(&:name).grep(/_collab$/)
paths.concat projects.map { |x| FavoritePath.new("/storage/group/#{x.delete '_collab'}", title: "#{x}") }

All I get from the groups is the dth5124 group. The path to the files is the group name minus the ‘_collab’ at the end. What is wrong here?

When you run:

projects = User.new.groups.map(&:name).grep(/_collab$/)

What is the content of that variable after? It looks correct to me and seems like it should work but let’s confirm it has what you expect.

After that, I think ruby’s gsub might be better for what needs done here to construct those paths:

paths.concat projects.map { |x| FavoritePath.new("/storage/group/#{x.gsub('_collab', '')}", title: "#{x}") }

When I do a projects.length I get 4 which is what I would expect to get but I only get one in the paths variable.

When I changed the x.delete to the x.gsub I got the second group to show up.

And now I see why the other 2 groups do not show up. They no longer exist on the filesystem. That would explain it.