ruby on rails devise

1.add


 
gem 'devise'
bundle
rails g devise:install

2. configure



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

<br> <p calss="notice"><%= notice %></p><br> <p calss="alert"><%= alert %></p><br>
<%= yield %>

3.page model



rails g devise:views
rails g devise user
modify create_user.migration select what you should
rake db:migrate
modify model to fit migration

4.configure mailer



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 => '[email protected]'
:passowrd => '********'
:domain => 'TDO'
:enable_stattls_auto => true
}

你可能感兴趣的:(ruby on rails devise)