I use devise (3.1.1) with confirmation enabled.
1st issue
confirmation_url
is not like expected
My /app/views/devise/mailer/confirmation_instructions.html.erb
contains
<p><%= link_to 'confirm', confirmation_url(@resource, :confirmation_token => @token) %></p>
Expected is:
http://localhost:3000/?confirm/confirmation_token=3DXF7mw4KcJxtD698coCdH
but I got
?confirmation_token=3DXF7mw4KcJxtD698coCdH
with this error
Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
2nd Issue
Token does not match
confirmation_token.invalid
But I have
config.action_controller.default_url_options = {host: 'localhost', port: 3000}
in test.rb
AND development.rb
:
Not sure why the token does not match but you could easily fix the first issue with the following:
# development.rb and test.rb
config.action_mailer.default_url_options = { :host => "localhost:3000" }
As for the production environment configuration, that is up to you.