Add :default option to belongs_to (#28453)
Use it to specify that an association should be initialized with a particular record before validation. For example: # Before belongs_to :account before_validation -> { self.account ||= Current.account } # After belongs_to :account, default: -> { Current.account }
Showing
想要评论请 注册 或 登录