0

Article HABTM authors

In Article model, i say:

validates_associated :authors

But, by creating of the new Article, this validation does't happen, because i don't see the errors.

Another errors are displayed properly, but this.

I render errors so:

<div class="errors">
    <%= article_form.error_messages %>
</div>

What's wrong here ?

AntonAL
  • 16,692
  • 21
  • 80
  • 114

1 Answers1

1

Validates_associated should work with any kind of association. Try to display your errors either with:

<%= @article.errors.full_messages.to_sentence %>

or

<%- for author in @article.authors %>
  <%= author.errors.full_messages.to_sentence %>
<%- end %>
Yannis
  • 5,426
  • 1
  • 31
  • 30