I created a form using the fields of the destination object using
form_for by following the example in the linked exercise, but I’m getting an error message:
undefined method `name’ for #<ActionView::Helpers::FormBuilder:0x000000034477a0>
In app/views/destinations/edit.html.erb it should have access to the destination object. If this is creating a form using the properties of that object, why is it talking about a method? I have to admit, this is going right over my head. I feel like I’m just following instructions without gaining much understanding of what’s actually happening in the code.
Here’s my code:
<%= form_for(@destination) do |d| %> <div class="field"> <%= d.name :name %><br> <%= d.image :image %><br> <%= d.description :description %> </div> <% end %>
What’s wrong with my code and what is it actually doing?