开发者

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.

开发者_StackOverflow中文版

routes.rb

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

    root :to => "home#index"
      end


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


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜