0

In my rails partial (_form.html.erb) I wrote this:

<%= f.text_field :title, required: true %>

The generated html is:

<input required="required" type="text" name="task[title]" id="task_title">

It works fine, but I want this:

<input type="text" name="task[title]" id="task_title" required>

How to set just 'required' into tag?

atw
  • 5,428
  • 10
  • 39
  • 63
Kostya Kokosko
  • 45
  • 1
  • 11

1 Answers1

2

Please see this post. There is no such thing as a valueless attribute.

So, no matter what you write required or required='true' or required='false', would all mean the same thing. The input is required.

Community
  • 1
  • 1
bsvin33t
  • 628
  • 9
  • 19