Skip to content

Instantly share code, notes, and snippets.

@sunny4381
Last active February 19, 2016 12:09
Show Gist options
  • Save sunny4381/84d845d5ca97a5920c85 to your computer and use it in GitHub Desktop.
Save sunny4381/84d845d5ca97a5920c85 to your computer and use it in GitHub Desktop.
Strong Parameter で Unpermitted parameters と表示された時の Rails Console での検証方法
Rails Console で次のコマンドを試す
```ruby
very_complicated_post = {
"item" => {
"point"=>{
"loc"=>{
"lng"=>"138.08578491210937",
"lat"=>"36.24584590837756"},
"zoom_level"=>"10" } } }
params = ActionController::Parameters.new(very_complicated_post)
params.require(:item).permit(point: [ :zoom_level, { loc: [ :lat, :lng ] } ])
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment