Hy guys... i'm learning Ruby on Rail but i don't know whats going on on this page, this is my error:
NoMethodError in Contacts#new Showing /home/ubuntu/workspace/simplecodecasts_saas/app/views/contacts/new.html.erb where line #7 raised: undefined method `name' for #
this is my new.html.erb
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="well">
<%= form_for @contact do |f| %>
<div class="form-group">
<%= f.label :name %>
<%= f.text_field :name, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, class: 'form-control' %>
</div>
<div class="form-group">
<%= f.label :comments %>
<%= f.text_area :comments, class: 'form-control' %>
</div>
<%= f.submit 'Submit', class: 'btn btn-default' %>
<% end %>
</div>
</div>
</div>
this is my routes
Rails.application.routes.draw do
resources :contacts
get '/about' => 'pages#about'
root 'pages#home'
and my contacts_controller.rb
class ContactsController < ApplicationController
def new
@contact = Contact.new
end
def create
end
end
what is going wrong?
Aucun commentaire:
Enregistrer un commentaire