accepts-nested-attributes

Rails - Unpermitted nested children parameters [duplicate]

半腔热情 提交于 2019-12-25 18:24:44
问题 This question already has an answer here : Unpermitted parameters nested attributes - rails (1 answer) Closed 2 years ago . The parent is saved but the children isn't. If I add landslide.sources.create , it does create a row in sources table with the correct landslide_id but all the other columns are null. Here's the files: landslide_controller.rb def new @landslide = Landslide.new @landslide.sources.build end def create landslide = Landslide.new(landslide_params) landslide.save end def