Skip to content
Permalink
Browse files

Updated action parameters guide

  • Loading branch information...
jodosha committed Nov 12, 2016
1 parent fe7a54c commit 4528c8647ea1195f41f79f11651a796a9dcbb440
Showing with 3 additions and 3 deletions.
  1. +3 −3 source/guides/actions/parameters.md
@@ -48,11 +48,11 @@ Because `params[:book]` is `nil`, we can't access `:title`.
In this case Ruby will raise a `NoMethodError`.

We have a safe solution for our problem: `#get`.
It accepts a **dot separated** string, where each token represents a level in our nested structure.
It accepts a list of symbols, where each symbol represents a level in our nested structure.

```ruby
params.get('book.title') # => "Hanami"
params.get('unknown.nested.param') # => nil instead of NoMethodError
params.get(:book, :title) # => "Hanami"
params.get(:unknown, :nested, :param) # => nil instead of NoMethodError
```

## Whitelisting

0 comments on commit 4528c86

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