Reputation: 1
The required in "brand" doesn't work and I don't know why.
View:
<%= simple_form_for(@equipment) do |f| %>
<div class="form-inputs">
<%= f.input :brand, required:true,:label => "test" %>
Controller:
params.require(:equipment)
.permit(:brand, :acquisition_year, :energy_label)
Model:
validates_presence_of :brand, :message => "brand"
Upvotes: 0
Views: 39
Reputation: 3451
Try without brackets in the form:
<%= simple_form_for @equipment do |f| %>
<div class="form-inputs">
<%= f.input :brand, required: true, label: 'test' %>
</div>
[...]
<% end >
Upvotes: 1
Reputation: 310
Try this:
<%= f.input :brand, required: true, label: "test" %>
See an empty space on 'true'
Upvotes: 0