Rails 2.0.2 upgrade -> undefined method `user_path'

I’ve tried to upgrade my Rails 1.5 app to 2.0.2

I’ve run into this error:

Showing login/login.rhtml where line #4 raised:

undefined method `user_path’ for #ActionView::Base:0x35cd55c

Extracted source (around line #4):

1:
2: Please Log In
3:
4: <% form_for User do %>
5:
6:


7: Name:

What’s wrong with the code at line #4? Am I missing something big here
on the switch to 2.0?

Thanks for your help,

Ok, figured it out.

Just had to change

form_for User

to

form_for :user

Hope this will help someone

On 2/7/08, Jason F. [email protected] wrote:

form_for :user

Although if you’re really serious about conversion to 2.0 you might
want to attack this from the other direction.

user_path is missing because you don’t have a named route for user.
In a conventional rails 2.0 restful application the controller for
User would be named UsersController, and in the config/routes.rb you’d
have

ActionController::Routing::Routes.draw do |map|
map.resources :users

which would generate a bunch of named routes and path/url helpers
including the missing user_path

AND in form for you can use

form_for @user

and it would automatically figure out what to generate including
making the form post if @user is a new record, and update if not.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/