Trouble with accepts_nested_attributes_for in Rails 5.0.0.beta3, -api option

后端 未结 5 1882
野性不改
野性不改 2021-01-04 19:28

I am using Rails 5.0.0.beta3, building an API-only app using the -app option on rails new, and I am having trouble with accepts_nested_attributes_for.

In my app, a

5条回答
  •  余生分开走
    2021-01-04 19:53

    I also encountered the same problem.
    It seems specification has been changed from Rails 5.
    By putting the option, and the previous and the same operation.

    belongs_to should default to required: true #18233

    class Post < ApplicationRecord
      belongs_to :member, optional: true
    end
    

    It is my clumsy may speak English, but ...

提交回复
热议问题