Part 7 step 5 cant figure out


#1

Feel like I'm going 1 step forward 2 steps back in this.

Can anyone help me with my code for this section i really don't understand it

<div class="container" >
 
     <%= image_tag t.image %>
    <%= form_for @destination do |t| %>
    <div class="field"> 
      <%= t.name %>
      <%= t.description %> 

  </div> 
  <% end %>
  </div>

Errors I'm getting are:
wrong number of arguments (0 for 1..2)
or
undefined method `name' for #


#2

Hi James,

@destination should be in parenthesis (() after form_for like this: form_for(@destination) ...

Inside that, each thing should be in a separate <div class="field">, (or actions for the submit button) like this:

<div class="field">
  <%= f.label :name %>
  <br>
  <%= f.text_field :name %>
</div>
<div class="field">
  <%= f.label :description %>
  <br>
  <%= f.text_area :description %>
</div>
<div class="actions">
  <%= f.submit "Create" %>
</div>

#3

Thank you that worked


#4

When is it appropriate to use text_field vs text_area (or is this a CSS question)?

Thank you.


#5

@micropro88447 text_field is for one (usually pretty short) line of text, like the title of a page or something. text_area is when you have an unknown, but possibly very long piece of text, like this post.
If something is stored as a string in the database, text_field is what you want, and if it's stored as text in your DB, text_area is what you should use.

I hope that helped you :slightly_smiling:

Edit:
And no, it's not a CSS question. It's a cross between being a question about HTML elements (<input type="text"> versus <textarea>), and a question about Rails :slightly_smiling:


#6