codeforamerica/michigan-benefits

View on GitHub
lib/generators/section/templates/form_model.template

Summary

Maintainability
Test Coverage
class <%= model.camelcase %>Form < Form

  <%- if options.doc? -%>
  # Whitelist top-level parameter names for CommonApplication, e.g.
  #
  #   given params: { form: {
  #      living_situation: "stable_housing",
  #      members: { "1" => { first_name: "Christa" } }
  #   }}
  #
  #   set_attributes_for :application,
  #                      :living_situation, :members,
  #
  # Delete the method if you aren't updating the CommonApplication.
  <%- end -%>
  set_attributes_for :application,

  <%- if options.doc? -%>
  # Whitelist top-level parameter names for a single HouseholdMember, e.g.
  #
  #   given params: { form: { first_name: "value", last_name: "value" } }
  #
  #   set_attributes_for :member,
  #                      :first_name, :last_name
  #
  # Delete the method if you aren't updating a single HouseholdMember.
  <%- end -%>
  set_attributes_for :member,

  <%- if options.doc? -%>
  # Whitelist top-level parameter names for ApplicationNavigator, e.g.
  #
  #   given params: { form: { anyone_requesting_food: "yes" } }
  #
  #   set_attributes_for :navigator, :anyone_requesting_food
  #
  # These attributes should be used for application flow, and not to fill out
  # the application PDF.
  #
  # Delete the method if you aren't updating the ApplicationNavigator.
  <%- end -%>
  set_attributes_for :navigator,
end