undefined method `new_confirmation_path' Confirmation Module Devise + MongoID

hyperrjas picture hyperrjas · Sep 30, 2011 · Viewed 7.4k times · Source

I am trying to work with Rails 3.1 + Devise Module :confirmable + MongoID with this template:

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

Mi template working fine but now I have generate confirmable views with the next command:

rails generate devise:views confirmable

Generate this:

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

I catch the next error to refresh the page:

NoMethodError in Devise/sessions#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' %>

Why not working my login, sign_up...etc pages?

Answer

hyperrjas picture hyperrjas · Oct 2, 2012

If you have this problem when installed devise + mongoid + :confirmable module:

!!You must restart the server¡¡

The steps are:

When you have installed devise + mongoid then:

1º enable :confirmable module in your User Model

2º run the command:

rails generate devise:views confirmable 

Restart the rails server

Regards!