fetlife/rollout

Is there a way to fetch the flags for a user

joelr opened this issue · 6 comments

it would be great to get a list of flags currently available to a user..

I'm not sure what you mean by "flags". Do you mean to say it would be great to show what features a user has activated?

Yup, sorry I meant features per user (internally we refer to them as
feature flags).

On Saturday, May 24, 2014, Eric Rafaloff notifications@github.com wrote:

I'm not sure what you mean by "flags". Do you mean to say it would be
great to show what features a user has activated?


Reply to this email directly or view it on GitHubhttps://github.com//issues/52#issuecomment-44058903
.

Joel Richards

Right now, you can do this by enumerating over an array of expected feature names and calling active?(feature, user) for each. You can get a list of features by calling features.

However, I agree that something like this should be apart of Rollout.

In our app, we wrap rollout for a bit more flexibility, and we solve this in the way that @EricR mentions

def all_for_user(user)
  $rollout.features.select do |feature|
    $rollout.active?(feature, user)
  end
end

Closed by #90