Skip to content

Commit

Permalink
Updated README.md with details of new per_user feature value contribu…
Browse files Browse the repository at this point in the history
…ted by Mark Moschel
  • Loading branch information
AndyObtiva committed Jan 19, 2014
1 parent 1a824e5 commit 3204eaf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ enabled (true) or disabled (false) per environment (e.g. production).
> feature1: true
> feature2: true
> feature3: false
> feature4: per_user
>
> development:
> <<: *defaults
Expand Down Expand Up @@ -122,8 +123,7 @@ Note that <code>feature_enabled?</code> returns false if the feature is disabled

### Per-User Feature Enablement

It is possible to restrict enablement of features per specific users. This works in concert with having a feature enabled
in features.yml (or one of the overrides like features.local.yml or environment variable overrides)
It is possible to restrict enablement of features per specific users by setting a feature value to <code>per_user</code>.

1. Use <code>toggle_features_for_user</code> in Ruby code to enable features per user ID (e.g. email address or database ID). This loads Redis client gem into memory and stores per-user feature configuration in Redis.
In the example below, current_user is a method that provides the current signed in user (e.g. using Rails [Devise] (https://github.com/plataformatec/devise) library).
Expand Down Expand Up @@ -155,6 +155,13 @@ Examples:
> # THIS ONE WILL NOT EXECUTE
> end
Note:

If a feature is enabled as <code>true</code> or disabled as <code>false</code> in features.yml (or one of the overrides
like features.local.yml or environment variable overrides), then it overrides toggled per-user restrictions, becoming
enabled or disabled globally.


Recommendations
---------------

Expand Down

0 comments on commit 3204eaf

Please sign in to comment.