Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • hi Dennis, where is your controller permit parameters action? Commented Sep 9, 2015 at 5:31
  • 1
    Actually that should be inside beer. See what you have written on controller is params.require(:beer) which means the params hash has a key named beer and the attributes to permit are inside it. In your JSON request you have this: "beer"=>{"id"=>213, "name"=>"Amber", "brewery_id"=>16} from which id is not permitted so it is showing Unpermitted parameters: id. Of the rest it don't cares whatever you are sending. Because rails will use the attributes inside beer to create/update it. Commented Sep 9, 2015 at 5:37
  • So why isn't style_ids inside of the beer hash when using JSON? Rails considers the other arguments inside that hash, but not style_ids. @huanson, I'm not sure I follow... the entire permit parameters is inside a function: def beer_params params.require(:beer).permit(:name, :brewery_id, :style_ids => []) end I call this from my update and create functions. Commented Sep 9, 2015 at 5:46