【问题标题】:undefined method `new_confirmation_path' Confirmation Module Devise + MongoID未定义的方法`new_confirmation_path'确认模块设计+ MongoID
【发布时间】:2011-11-28 14:37:40
【问题描述】:

我正在尝试使用 Rails 3.1 + 设计模块 :confirmable + MongoID 使用此模板:

https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-devise-template.rb

Mi 模板工作正常,但现在我已使用下一个命令生成可确认的视图:

rails generate devise:views可确认

生成这个:

invoke  Devise::Generators::SharedViewsGenerator
  create    app/views/confirmable/mailer
  create    app/views/confirmable/mailer/confirmation_instructions.html.erb
  create    app/views/confirmable/mailer/reset_password_instructions.html.erb
  create    app/views/confirmable/mailer/unlock_instructions.html.erb
  create    app/views/confirmable/shared
  create    app/views/confirmable/shared/_links.erb
  invoke  form_for
  create    app/views/confirmable/confirmations
  create    app/views/confirmable/confirmations/new.html.erb
  create    app/views/confirmable/passwords
  create    app/views/confirmable/passwords/edit.html.erb
  create    app/views/confirmable/passwords/new.html.erb
  create    app/views/confirmable/registrations
  create    app/views/confirmable/registrations/edit.html.erb
  create    app/views/confirmable/registrations/new.html.erb
  create    app/views/confirmable/sessions
  create    app/views/confirmable/sessions/new.html.erb
  create    app/views/confirmable/unlocks
  create    app/views/confirmable/unlocks/new.html.erb

我捕捉到下一个错误以刷新页面:

设计/会话中的 NoMethodError#new

undefined method `new_confirmation_path' for #<#<Class:0xb94bb04>:0xb948b20>

11: <% end -%>
12: 
13: <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14:   <%= link_to "Didn't receive confirmation instructions?",     new_confirmation_path(resource_name) %><br />
15: <% end -%>
16: 
17: <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email)     && controller_name != 'unlocks' %>

为什么我的登录、注册...等页面无法正常工作?

【问题讨论】:

  • 现在工作正常:D。对于每个人在安装 devise + mongoid + :confirmable 模块时都会遇到这个问题,问题是!!你必须重新启动服务器¡¡ 步骤是:当你安装了 devise + mongoid 然后:1º 在你的用户中启用 :confirmable 模块模型 2º 执行命令:rails generate devise:views confirmable 3º 重启服务器 rails 瞧!非常感谢

标签: ruby-on-rails views devise mongoid


【解决方案1】:

如果你在安装 devise + mongoid + :confirmable 模块时遇到这个问题:

!!必须重启服务器¡¡

步骤如下:

当你安装好 devise + mongoid 之后:

1º 在你的用户模型中启用:confirmable 模块

2º运行命令:

rails generate devise:views confirmable 

重启rails服务器

问候!

【讨论】:

  • 重启服务器,重启服务器,你当我傻?我是。经验是,当你一次又一次地认识到自己的错误时
  • 哈哈是的我也笨!还是懒惰,反正。太懒了,我查了一下,而不是花几秒钟思考它:)
猜你喜欢
  • 2016-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多