Commit a7cc06bd authored by Tomislav Nikić's avatar Tomislav Nikić Committed by Amy Qualls

Adding a section on resource and ffs

In this addition I am adding a small section on how to use ff
while working with resource creation.
parent 810bd9cc
......@@ -118,6 +118,32 @@ view 'app/views/devise/passwords/new_edit_behind_ff.html.haml' do
end
```
## Working with resource classes
If a resource class must behave differently when a feature flag is active, toggle a
variable with the name of the feature flag inside the class. This variable and condition
ensure all actions are handled appropriately.
You can set this variable inside the `fabricate_via_api` call. For a consistent approach:
- Use an `activated` check, not a deactivated one.
- Add the word `activated` to the end of a variable's name.
- Inside the `initialize` method, set the variable's default value.
For example:
```ruby
def initialize
name_of_the_future_flag_activated = false
...
end
```
### Cleanup
After the feature flag is removed, clean up the resource class and delete the variable.
All methods should use the condition procedures of the now-default state.
## Running a scenario with a feature flag enabled
It's also possible to run an entire scenario with a feature flag enabled, without having to edit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment