私は持っている
class Profile
has_many :favorite_books, :dependent => :destroy
has_many :favorite_quotes, :dependent => :destroy
accepts_nested_attributes_for :favorite_books, :allow_destroy => true
accepts_nested_attributes_for :favorite_quotes, :allow_destroy => true
end
「+」を押して新しいお気に入りを作成するための新しいテキストエリアを追加する動的フォームがあります。私がやりたいことは、空白のものを無視することです。ネストされていない属性よりも、更新コントローラーでこれを並べ替えるのが難しいと思います。
私が一時的に持っているのは、空のレコードを削除する after_save コールバックのハックです。これらの空白のオブジェクトを無視する最も簡単な方法は何ですか?
検証とエラーは必要ありません。サイレント削除/無視だけです。