Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>1.</strong> Make sure you include confirmable in Model.devise call</p> <pre><code>class User &lt; ActiveRecord::Base devise :database_authenticatable, :confirmable ... end </code></pre> <p><strong>2.</strong> Make sure you add confirmable to the user migration</p> <pre><code>create_table :users do |t| t.database_authenticatable t.confirmable ... end </code></pre> <p>If you're using devise 2.0+ this fails because devise no longer provides migration helpers, and so <code>t.confirmable</code> raises an error. Instead, copy the block labeled "Confirmable" from <a href="https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0-migration-schema-style#after" rel="noreferrer">their migration guide</a>.</p> <p><strong>3.</strong> Generate the devise views, with either of the following commands,so you can override the devise mailer views:</p> <pre><code>rails generate devise:views # global rails generate devise:views users # scoped </code></pre> <p>You can now override the mailer views in <code>devise/mailer/confirmation_instructions.html.erb</code> or <code>users/mailer/confirmation_instructions.html.erb</code> depending on your setup</p> <p><strong>4.</strong> For <strong>development</strong> environment add the following config lines in <code>/config/environments/development.rb</code></p> <pre><code>config.action_mailer.default_url_options = { :host =&gt; 'localhost:3000' } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = {:address =&gt; "localhost", :port =&gt; 1025} </code></pre> <p><strong>5.</strong> For <strong>production</strong> environment in <code>/config/environments/production.rb</code> you may use something similar to the following (supposing you have a SMTP server on localhost:25):</p> <pre><code>config.action_mailer.default_url_options = {:host =&gt; 'yourdomain.com'} config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address =&gt; "127.0.0.1", :port =&gt; 25, :domain =&gt; 'yourdomain.com' } </code></pre> <p><strong>6</strong> To test the setup in development install the mailcatcher gem, that you will use as a SMTP server in development, catching all incoming mails and displaying them on <code>http://localhost:1080/</code>:</p> <pre><code>gem install mailcatcher </code></pre> <p>Once installed start the mailcatcher server with the command:</p> <pre><code>mailcatcher </code></pre> <p>A toy SMTP server will be running on port 1025 catching emails and displaing them on HTTP port 1080.</p> <p><strong>You can now create an account and see the confirmations.</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload