Print an asterisk along with required fields

Hi guys,

For some forms, I have to print an asterisk along with each required
field.
Like most of the sites does.

But, if I have this information in my model (validates_presence_of), is
there a way to identify whether a field is required at the moment I am
rendering it in the view?

Something like:

<%= '* ’ if obj.name.is_required? %><%= f.label :name, ‘Name’%>

Thanks in advance.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs