I’ve just set up rvm with a gemset for rails 3.1 to start building an app in it.
I am trying to just START with a users controller and model. Here is what I have done so far:
rails g controller users new
rails generate model user email:string password_digest:string
/app/controllers/users_controller.rb
class UsersController < ApplicationController
def new
@user = User.new
end
end
/app/views/users/new.html.erb
<h1>Signup</h1>
<%= form_for @user do |f| %>
<%= f.label :email %>
<%= f.text_field :email %>
<% end %>
config/routes.rb
WorkOut::Application.routes.draw do
get "users/new"
end
And That’s it. I’m pretty new to rails, and I’ve tried everything I know, but when I start up rails server, and navigate to http://localhost:3000/users/new I get this error:
undefined method `hash_for_users_path' for #<Module:0x00000102ad1058>
Extracted source (around line #3):
1: <h1>Signup</h1>
2:
3: <%= form_for @user do |f| %>
4: <%= f.label :email %>
5: <%= f.text_field :email %>
6: <% end %>
Thanks in advance! I’m sure it’s something crazy simple I’m missing…
1 Answer