Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
msimonborg committed Aug 1, 2017
1 parent 11d29d7 commit 082ec3c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Or install it yourself as:
$ gem install forbidium

## Usage
The gem will add four methods to `Hash`: `#allow`, `#allow!`, `#forbid`, and `#forbid!`

```ruby
hash = { one: 'one', two: 'two' }

Expand All @@ -41,6 +43,14 @@ hash.forbid!(two: 'two') # => {}
hash # => {}
```

When added to the `Gemfile` in a Rails project, `ActionController::Parameters` will also receive these methods so you can use them with your `strong_parameters`:

```ruby
def user_params
params.require(:user).permit(:email, :password, :role).forbid(role: ['sys_admin', 'owner'])
end
```

## Platform support

Tested against:
Expand Down

0 comments on commit 082ec3c

Please sign in to comment.