Skip to content
Permalink
Browse files

Guides removed Indifferent Access from params 🎉

  • Loading branch information...
jodosha committed Jul 19, 2016
1 parent 26d402c commit a4693c980edcbbb49f3f87803e3916c0544e29d9
Showing with 2 additions and 21 deletions.
  1. +2 −21 source/guides/actions/parameters.md
@@ -34,32 +34,13 @@ end

If we visit `/dashboard?q=foo`, we should see `Query string: foo`.

### Indifferent Access
### Symbol Access

Until the version 2.2.0 of MRI (Matz Ruby Interpreter), symbols weren't garbage collected.
Because params come from untrusted sources (the web), we cannot automatically symbolize their keys.
This is a security mechanism to avoid an attack called _Symbol DoS_.

Params are stored internally with string keys, but they offer a convenient access for symbols too.
Params and nested params can be referenced **only** via symbols.

```ruby
params[:q]
# or
params['q']
```

<p class="warning">
Indifferent Access may be removed in future versions of Hanami in favor of symbol access only.
</p>

### Nested Access

Params also offer indifferent access for nested values.

```ruby
params[:book][:title]
# or
params['book']['title']
```

Now, what happens if the parameter `:book` is missing from the request?

0 comments on commit a4693c9

Please sign in to comment.
You can’t perform that action at this time.