Signup I Step 4 - trouble with form


#1

I've been stuck on this for a couple of days, so now I only do enough to prompt the error:
"Did you add a field for the user's first_name?"

Here's my code:

  <%= form_for(@user) do |u| %>
  <div class="field">
    <%= u.label :first_name %><br>
    <%= u.text_area :first_name %>
  </div>
  
  <% end %>

I'm not sure what the problem is, because in Learn ROR > Associations > Update, the following code worked just fine:

<%= form_for(@destination) do |f| %>  
  <div class="field"> 
    <%= f.label :name %><br> 
    <%= f.text_area :name %> 
  </div> 
  (etc)
<% end %>

What am I doing wrong?


#2

Try this code, it wants the other fields

<%= form_for(@user) do |f| %>
<%= f.text_field :first_name, :placeholder => "First name" %>
<%= f.text_field :last_name, :placeholder => "Last name" %>
<%= f.email_field :email, :placeholder => "Email" %>
<%= f.password_field :password, :placeholder => "Password" %>
<%= f.submit "Create an account", class: "btn-submit" %>
<% end %>


4. Signup I
Signup I - form_for
#4

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.