I set up a custom view for my registration form.
%h2.mt-20.text-lg.font-semibold.text-gray-900 Get started for free
%p.mt-2.text-sm.text-gray-700
Already registered?
= link_to "Sign in", sign_in_path, class: "font-medium text-blue-600 hover:underline"
to your account.
= form_with(url: sign_up_path, class: "mt-10 grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2") do |form|
%div
= form.label :first_name, class: "mb-3 block text-sm font-medium text-gray-700"
= form.text_field :first_name, class: "block w-full appearance-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:bg-white focus:outline-none focus:ring-blue-500 sm:text-sm"
%div
= form.label :last_name, class: "mb-3 block text-sm font-medium text-gray-700"
= form.text_field :last_name, class: "block w-full appearance-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:bg-white focus:outline-none focus:ring-blue-500 sm:text-sm"
.col-span-full
= form.label :email, "Email address", class: "mb-3 block text-sm font-medium text-gray-700"
= form.email_field :email, class: "block w-full appearance-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:bg-white focus:outline-none focus:ring-blue-500 sm:text-sm"
.col-span-full
= form.label :password, class: "mb-3 block text-sm font-medium text-gray-700"
= form.password_field :password, class: "block w-full appearance-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:bg-white focus:outline-none focus:ring-blue-500 sm:text-sm"
.col-span-full
= form.label :password_confirmation, class: "mb-3 block text-sm font-medium text-gray-700"
= form.password_field :password_confirmation, class: "block w-full appearance-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:bg-white focus:outline-none focus:ring-blue-500 sm:text-sm"
.col-span-full
= form.label :traffic_source, "How did you hear about us?", class: "mb-3 block text-sm font-medium text-gray-700"
= form.select :traffic_source, User.traffic_source_options, {}, {class: "block w-full appearance-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:bg-white focus:outline-none focus:ring-blue-500 sm:text-sm pr-8"}
.col-span-full
= button_tag type: 'submit', class: "group inline-flex items-center justify-center rounded-full py-2 px-4 text-sm font-semibold focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 bg-blue-600 text-white hover:text-slate-100 hover:bg-blue-500 active:bg-blue-800 active:text-blue-100 focus-visible:outline-blue-600 w-full" do
%span
Sign up โ
You find this in the logs...
Unpermitted parameters: :authenticity_token, :first_name, :last_name, :traffic_source, :button. Context: { controller: ActionAuth::RegistrationsController, action: create, request: #<ActionDispatch::Request:0x0000000127dc14a0>, params: {"authenticity_token"=>"[FILTERED]", "first_name"=>"Charles", "last_name"=>"Wood", "email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "traffic_source"=>"google", "button"=>"", "controller"=>"action_auth/registrations", "action"=>"create"} }
If I remove the first_name, last_name, and traffic_source fields, I still get unpermitted paramters on authenticity_token and button.