How to get validates_presence_of worked in this situation?


#1

Suppose:
class articles < ActiveRecord::Base
has_many :assistarticles

validates_presence_of :body
end

class assistarticles < ActiveRecord::Base
belongs_to :article

validates_presence_of :detail
end

In the submit form:
<%= text_field ‘article’, ‘body’ %>
<%= text_field ‘assistarticle’, ‘detail’ %>

The process logic will be done in article_controller
Now if the article.body field is empty,then validates_presence_of will
work and return the error to let user re-enter the body content,but if
the assistarticles.detail is empty,then no tips at all,and the
accordingly record will not be stored,either. How to let the latter
validates_presence_of work?

Thanks
Charlie