<h2>1.add</h2>
<pre> <span class="inner-pre" style="font-size: 20px">
gem 'devise'
bundle
rails g devise:install
</span></pre>
<h2>2. configure </h2>
<pre><span class="inner-pre" style="font-size: 20px">
development.rb
config.action_mailer.default_url_options = {:host=>'localhost:3000'}
config.action_mailer.delivery_method =:stmp
config.action_mailer.perform_deliveries=true
layoutes/application.html.erb
<xmp >
<p calss="notice"><%= notice %></p>
<p calss="alert"><%= alert %></p>
</xmp>
<%= yield %>
</span></pre>
<h2>3.page model</h2>
<pre><span class="inner-pre" style="font-size: 20px">
rails g devise:views
rails g devise user
modify create_user.migration select what you should
rake db:migrate
modify model to fit migration
</span></pre>
<h2>4.configure mailer</h2>
<pre><span class="inner-pre" style="font-size: 20px">
new file config initializers/setup_mail.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => 'smtp.163.com'
:port => '587'
:authentication => :plain,
:user_name => 'senluowanxiangt@163.com'
:passowrd => '********'
:domain => 'TDO'
:enable_stattls_auto => true
}
</span></pre>
网友评论