SimpleForm provides flexible form helpers for Ruby on Rails applications.
Basic Form Template
<%= simple_form_for @user do |f| %>
<%= f.input :email, required: true, autofocus: true %>
<%= f.input :password, required: true %>
<%= f.input :remember_me, as: :boolean %>
<%= f.button :submit, "Sign in", class: "btn-primary" %>
<% end %>
Input Types and Options
<%= f.input :bio, as: :text, input_html: { rows: 5 } %>
<%= f.input :role, collection: ['Admin', 'Editor', 'Subscriber'], prompt: "Select Role" %>
<%= f.input :birth_date, as: :date, start_year: 1980 %>
<%= f.input :accepted_terms, as: :boolean, label: "I accept the terms and conditions" %>
Custom Form Wrappers
<%# Apply custom wrapper defined in config/initializers/simple_form.rb %>
<%= simple_form_for @user, wrapper: :inline_form do |f| %>
<%= f.input :query, label: false, placeholder: "Search..." %>
<%= f.button :submit, "Search" %>
<% end %>
Form Associations
<%# Belongs to / Has many associations %>
<%= f.association :company, collection: Company.all, prompt: "Choose Company" %>
<%= f.association :roles, as: :check_boxes %>
```\n