标签: ruby-on-rails-4
其实我有两个型号
class Article < ActiveRecord::Base has_many :experts accepts_nested_attributes_for :experts end class Expert < ActiveRecord::Base belongs_to :article end
现在我想在保存记录的同时验证“文章应该至少有一个专家”,如何在保存记录时验证相关模型?