2012-02-12 90 views
0

我的Rails 3.2.1,並嘗試以安裝Ubuntu色器件(1.1.rc0)NoMethodError在設計/註冊#新

我耙路線給我

new GET /users/registration/sign_up(.:format) devise/registrations#new 

config/routes.rb 
DeviseApp::Application.routes.draw do 
    devise_for :users 
    match "users/registration/sign_up" => "devise/registrations#new" 
    resources :projects 
    root :to => "home#index" 
end 

http://127.0.0.1:3000/users/registration/sign_up 我拿 未定義的方法`user_registration_path」的

的Gemfile 源 'https://rubygems.org'

gem 'rails', '3.2.1' 
gem 'sqlite3' 
gem 'devise', '1.1.rc0' 

group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

我遵循第209集介紹Devise Railscasts的說明。

回答

0

你必須定義爲named route的途徑,如果你想使用user_registration_path

match "users/registration/sign_up" => "devise/registrations#new", :as => 'user_registration' 
+0

感謝您的回答,修正了設計/註冊中的NoMethodError#new,但繼續並說設計/註冊中的ArgumentError#錯誤的參數數目(3代表2) – 2012-02-12 11:29:46

+0

@ΠαναγιώτηςΠετρίδης:查看控制檯中的堆棧跟蹤,它表示哪條線和哪個功能被誤用 – Baldrick 2012-02-12 11:45:08

+0

不幸我不明白也許堆棧跟蹤是這樣的? tic.rb:53:in'call' railties(3.2.1)lib/rails/engine.rb:479:in'call' railties(3.2.1)lib/rails/application.rb:220:in'電話' rack(1.4.1)lib/rack/content_length.rb:14:在'call'中 railties(3.2.1)lib/rails/rack/log_tailer.rb:14:在'call' rack(1.4 .1)lib/rack/handler/webrick.rb:59:在'service' – 2012-02-12 12:29:57

0

最終的解決方案是改變的Gemfile。新的Gemfile:

gem 'rails', '3.0.11' 
gem 'sqlite3', '1.3.3' 
gem 'devise' 
gem 'recaptcha', :require => 'recaptcha/rails' 

也許組合導軌'3.2.1'和'1.1.rc0'設計對我來說是災難性的。