Wednesday, April 18, 2012

NoMethodError in Shop#new

Im pretty new to Ruby but now i get an error when i try to at an barber to my database.



I get the following error:




NoMethodError in Shop#new




Showing /Users/Augus/Rails/Barbershop/app/views/shop/new.html.erb where line #3 raised:



undefined method `barbers_path' for #<#:0x105bfe360>
Extracted source (around line #3):




1: <H1>New barber</H1>
2:
3: <%= form_for @barber do |f| %>
4: <%= f.text_field :name %> <br />
5: <%= f.submit %>
6: <% end %>


I really dont know what im doing wrong.



My shop_controller.rb:



  def new
@barber = Barber.new
end


My view new.html.erb:



<H1>New barber</H1>

<%= form_for @barber do |f| %>
<%= f.text_field :name %> <br />
<%= f.submit %>
<% end %>

<%= link_to 'Back', shop_path %>


And i do got this in my routes:



  resources :shop




No comments:

Post a Comment