Pre-order

Strong parameters

One of the most powerful things about Superform is it understands the structure of the data being submitted into the form, which means it can automatically permit form parameters based on the structure of the data being submitted.

Form classes

Recall the UserForm class we created earlier:

class UserForm < ApplicationForm
  def view_template
    row field(:name).input(type: :text)
    row field(:email).input(type: :email)
    row field(:password).input(type: :password)

    submit("Sign Up")
  end
end

We’ll use this class in the view and the controller to handle rendering the form UI and processing the submitted data.

Integrating into the controller

Permitted parameters used by the form is a matter of creating an instance of a UserForm, then assigning the parameters to the form instance.

🔓 Unlock content

Pre-order this course to unlock this video, source code, and content. You'll also get to work with Brad to fine tune the course cirriculum.

Pre-order video course for $379 $249
class UsersController < ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  def ▓▓▓▓▓▓
    ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓.▓▓▓(▓▓▓▓▓), through: ▓▓▓▓▓▓[:user]

    if ▓▓▓▓▓.▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓, notice: "User created!"
    else
      ▓▓▓▓▓▓ :new
    end
  end
end