以one month rails的線上課程及codecademy的Ruby課程,紀錄及分享一個月來學習的歷程及心得。
Step1: 安裝Devise gem
gemfile.rb
gem 'devise'
terminal
$ bundle install
Step2: 設定Devise
config/environments/production.rb
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end
在上線後,:host要更改成真實要用的host,目前都跑本機,所以是localhost
config/application.rb
config.assets.initialize_on_precompile = false
terminal
$ rails generate devise:install
$ rails generate devise User
$ rake db:migrate
$ rake routes
Step3: Generate devise User
termanil
$ rails generate devise User
$ rake db:migrate
$ rake routes