I'm using Action Text for a Web CRUD I've created. The form has two main attributes:
title: Título
content: Contenido
Here's my form:
<%= simple_form_for(@announcement) do |f| %>
<%= f.error_notification %>
<%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
<div class="form-inputs">
<div class="form-group">
<%= f.input :title, input_html: { class: 'form-control' }, label_html: { class: 'form-label' }, required: false %>
</div>
<div class="form-group">
<label class="form-label"> <%= Announcement.human_attribute_name :cover %></label>
<%= f.input :cover, label: false, input_html: { class: 'form-control' }, as: :file, label_html: { class: 'form-label' }, required: false %>
</div>
<div class="form-group">
<label class="form-label"><%= Announcement.human_attribute_name :content %></label>
<%= f.rich_text_area :content, label_html: { class: 'form-label' }, required: false %>
</div>
<div class="form-group">
<label class="form-label"> <%= Announcement.human_attribute_name :is_active %></label>
<div class="custom-control custom-switch mr-2">
<%= f.check_box :is_active, class: 'custom-control-input', id: 'is-active-check' %>
<label class="custom-control-label" for="is-active-check" />
</div>
</div>
</div> <!-- END FORM INPUTS -->
<div class="form-actions">
<%= f.button :button, class: 'btn btn-primary mt-3' %>
</div>
<% end %> <!-- END FORM -->
In my model, I'm validating the presence of the fields:
validates :title, :content, presence: true
Problem:
When I submit an empty form the title field shows the expected validation errors. However the content field (Action Text) does not. The empty content field is preventing the record from being saved (this is OK), but like I said is not showing the error in the form.
Please take the following image as reference:
Question:
How can I show the validation errors for the content field?