katie
katie

Reputation: 2951

Devise No method error issue in rails 3.1

I just created rails 3.1 app and updated devise 1.4.7.But When i browse http://localhost:3000/users/sign_up(as indicated in rake routes) ,I get " NoMethodError in Devise/registrations#new " extracted source is line

  3: <%= form_for(resource_name, resource, :url => registration_path(resource_name)) do  |f| %>.

What is the solution to this?Thank you in advance.

routes.rb

    Deals::Application.routes.draw do
    devise_for :users
    match  "/users/sign_up" => "devise/registrations#new"

    root :to => "home#index"
      end

Upvotes: 0

Views: 1983

Answers (4)

akmur
akmur

Reputation: 1635

Restarting the server did it for me. Try it before anything else!

Upvotes: 1

NahAbiah
NahAbiah

Reputation: 16

You can try devise_for :users followed directly by resources :users

Upvotes: 0

Muhammad Sannan Khalid
Muhammad Sannan Khalid

Reputation: 3137

Use these lines in your routes.rb file.

root :to => "home#index"
devise_for :users
devise_scope :user do
    get "sign_in", :to => "devise/sessions#new"
    get "sign_out", :to => "devise/sessions#destroy"
    get "sign_up", :to => "devise/registrations#new"
end

Upvotes: 2

Jeff Dickey
Jeff Dickey

Reputation: 5034

Take out this part in config/routes.rb:

match "/users/sign_up" => "devise/registrations#new"

That's redundant, devise_for :users will add that route.

Upvotes: 0

Related Questions