Reputation: 13843
(ruby 1.9.2 rails 3.0.6)
I am new to ROR, sorry for my simple question.
I have a form and a controller, when i launch my app, i can see the log have been displayed.. however there are exception when rendering the view...
Everything should look just fine.. what is the problem? how can I fix it?
Thanks.
undefined method `users_path' for #<#<Class:0x47c7678>:0x47c6118>
Extracted source (around line #2):
1: <h1>Welcome Aboard</h1>
2: <%= form_for(@user) do |f| %>
3: <table>
4: <tr>
5: <td><%= f.label :username %></td>
class RegisterController < ApplicationController
def sign_up
logger.debug("sign_up inoked")
@user = User.new
logger.debug("sign_up finished")
end
end
views/register/sign_up.html.erb
<%= form_for(@user) do |f| %>
<table>
<tr>
<td><%= f.label :username %></td>
<td><%= f.text_field :username %></td>
</tr>
<tr>
<td><%= f.label :password %></td>
<td><%= f.password_field :password %></td>
</tr>
<tr>
<td><%= f.label :password_confirmation %></td>
<td><%= f.password_field :password_confirmation %></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2"><%= f.submit "Sign up" %></td>
</tr>
</table>
<% end %>
Upvotes: 2
Views: 5985
Reputation: 48596
It seems that you do not have the appropriate routes. Do you have a line like :
resources :users
in your routes.rb file ? If not try adding that please. Or just create the particular users_path named route.
Upvotes: 9