Is there any reason you would use
class User < ActiveRecord::Base
accepts_nested_attributes_for :posts, reject_if: proc do |attributes|
class Post < ActiveRecord::Base
validates :title, presence: true
If you use validation, the creation of
User will fail if there exists a
Post which does not have a title.
If you use
reject_if, the creation of
User will succeed even if some, or all, of the
Posts don't have titles. Only those posts without titles won't be saved.