I have the following code to display error messages:
<% if @profile.errors.any? %>
<% puts @profile.errors.full_messages.inspect.to_s %>
<ul>
<% @profile.errors.full_messages.each do |msg| %>
<% puts 'errors ared' + msg.to_s %>
<li><%= msg %></li>
<% end %>
</ul>
<% end %>
Here is the validation in the model:
validates :title, presence: true, length: {maximum: 50, minimum: 5, too_long: "Title cannot be longer than %{count} characters", too_short:" must be at least %{count} characters."}
For some reason, this prints both the name of the attribute with the error and the error. For example, if I am trying to display the error from updating a form field called "title", the error message will read:
Title Title cannot be longer than 50 characters
I have many error messages I want to display throughout my site and I don't want anything being written automatically. How do I get rid of the word "Title" at the beginning?