Is it possible to use Simple Form (by: Plataformatec) without a model?
https://github.com/plataformatec/simple_form
All of the methods above still leave you with form data nested inside of "user" or whatever symbol that you pass as the first argument. That's annoying.
To mimic simple_form's style/benefits, but remove the object/symbol dependency and the forced data nesting, you can create a partial.
HAML
examples:
form view:
= form_tag("path/to/action", method: "POST") do
= render "path/to/partial/field", type: "string", required: true, item: "first_name"
field
partial:
- required_string = required ? "required" : ""
%div{class: "input #{type} #{required_string} #{item}"}
%label{class: "#{type} #{required_string}", for: "#{item}"}
- if required
%abbr{title: "required"}
*
= t("application.#{item}")
%input{name: "#{item}", |
placeholder: t("application.#{item}"), |
type: "#{type}", |
required: required, |
"aria-required" => "#{required}" }