How to get validates_presence_of worked in this situation?

class articles < ActiveRecord::Base
has_many :assistarticles

validates_presence_of :body

class assistarticles < ActiveRecord::Base
belongs_to :article

validates_presence_of :detail

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?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs