Written by Indigo Tech Tutorials
July 27, 2025
To permit nested attributes in rails 8 with the new .expect method you need to wrap your nested attributes array in a double array. Weirdly enough this will permit the nested attributes. I was confused why my params where not getting permitted and I was getting an empty hash back when trying to save my model with nested records, but I remembered with the new .expect method you must wrap the attributes in 2 arrays like so. params.expect(user: [:email_address, :password, company: [[:name, :url, :logo]]])