2010-11-16 34 views
1

我試圖使用devise和mongomapper來獲得基本身份驗證。 繼這裏說明: http://johnwyles.com/2010/03/15/sessions-in-mongodb-using-mongomapper-and-devise/ (除了推遲routes.rb中修改,直到之後的發電機運行,以解決錯誤)在Rails上設置devise/mongomapper 2.3.8

我把它儘可能得到以下路徑工作: /用戶/ sign_up: : /用戶/ sign_in :: /用戶/密碼/新:: /用戶/確認/新

然而,僅僅試圖打 「/」 給我一個錯誤

NameError in UserController#sign_in 

uninitialized constant UserController 
RAILS_ROOT: /Users/bentrevino/Documents/Dev/devisetest 

Application Trace | Framework Trace | Full Trace 
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:443:in `load_missing_constant' 
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing' 
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing' 
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:364:in `constantize' 
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:in `each' 
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:in `constantize' 
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/string/inflections.rb:162:in `constantize' 
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:444:in `recognize' 
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:437:in `call' 

我提交的註冊請求後,我得到這個錯誤

RuntimeError in Registrations#create 

Showing /Library/Ruby/Gems/1.8/gems/devise-1.0.8/app/views/devise_mailer/confirmation_instructions.html.erb where line #5 raised: 

Missing host to link to! Please provide :host parameter or set default_url_options[:host] 
Extracted source (around line #5): 

2: 
3: <p>You can confirm your account through the link below:</p> 
4: 
5: <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p> 

是否有人知道可能會在這裏嗎? 謝謝! Ben ....

+0

你有沒有解決註冊請求錯誤?我按照教程,並將以下內容添加到config/environments/production.rb:config.action_mailer.default_url_options = {:host =>'mydomain.com'}但我得到了同樣的錯誤。 – Becky 2010-12-15 21:20:44

回答

0

至少有一個問題是您尚未爲您在config/routes.rb文件中指定的根路由創建控制器。運行一個調用rails generate controller [name]來創建一個新的控制器。然後在你的config/routes.rb文件中爲我們的根路由指定這個名字。