2 つのモデルがあるとします。コメントを投稿
class Post < ActiveRecord::Base
has_many :comments
accepts_nested_attributes_for :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
before_save :do_something
def do_something
# Please, let me do something!
end
end
コメント用のフィールドを備えた投稿用のフォームがあります。フィルターを除いて、すべてが期待どおりに機能します。上記の構成では、コメントの before_save フィルターはトリガーされません。
理由と、これを修正する方法を教えてください。