accepts_nested_attributes_for ignore blank values

前端 未结 1 1743
广开言路
广开言路 2020-12-17 18:23

i have

class Profile
  has_many :favorite_books, :dependent => :destroy
  has_many :favorite_quotes, :dependent => :destroy

  accepts_nested_attribute         


        
相关标签:
1条回答
  • 2020-12-17 18:47

    There is a built-in validation:

    :reject_if => lambda { |c| c[:name].blank? },
    
    0 讨论(0)
提交回复
热议问题