Nikolay's Blog

Rails SimpleForm render custom hint

Cover Image for Rails SimpleForm render custom hint
  • Created at:

When you need to render custom html hint you can pass html template to it

./app/views/users/_form.html.erb

<%= simple_form_for @user do |f| %>
  <%= f.input :name, hint: render('user_hint', user: f.object) %>
<% end %>

./app/views/users/_user_hint.html.erb

<% if user.verified? %>
  User verified
<% else %>
  User is not verified
<% end %>

Taken from issues/965