I'm using strong parameters in my User
controller in my Rails 4 application.
def new
@user = User.new
end
def create
@user = User.new(user_params)
if !@user.save
render :new
end
end
private
def user_params
params.require(:user).permit(:first_name, :last_name, :address_1, :address_2, :city, :state, :zip, :phone, :email, :password, :ssn)
end
I also have validation in the User
model.
validates_presence_of :first_name, :last_name
If the user fills out my form to create their account and don't pass the validation, when the controller renders the new
action, none of the previously fields the user filled out are populated, the entire form is blank. Am I missing something?