Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
I found this problem when using InheritedResources. Here fix and explanation why rails/rails#9534
  • Loading branch information
onemanstartup committed Nov 8, 2013
1 parent 476ae19 commit 89533d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,15 +683,15 @@ If you need `params.require` you can do it like this:

```ruby
def permitted_params
{:widget => params.require(:widget).permit(:permitted_field, :other_permitted_field)}
{:widget => params.fetch(:widget, {}).permit(:permitted_field, :other_permitted_field)}
end
```

Or better yet just override `#build_resource_params` directly:

```ruby
def build_resource_params
[params.require(:widget).permit(:permitted_field, :other_permitted_field)]
[params.fetch(:widget, {}).permit(:permitted_field, :other_permitted_field)]
end
```

Expand Down

0 comments on commit 89533d1

Please sign in to comment.