Skip to content

Instantly share code, notes, and snippets.

## Code binds to LDAP, searches users, returns multi-dimensional array for groups like so.
## Each element in the array represents a given users AD groups
## user_groups = [ [group1,group2], [group2,group3], [group2,group4] ]
My goal here is to get the common groups among all of the arrays and the only way I've found so far is this:
user_groups[0] & user_groups[1] & user_groups[2]
=> [group2]
class CreateReleaseSteps < ActiveRecord::Migration[5.0]
def change
create_table :release_steps do |t|
t.belongs_to :release, index: true
t.string :name
t.string :loadbalancer
t.string :comment
t.integer :release_id
end
end