Rails 7 gem devise

加入:gem "devise", github: "heartcombo/devise"

 指令: bundle install

            rails generate devise:install

在config/environments/development.rb

Rails.application.configure do

加入:config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

在app/views/layouts/application.html.erb

加入:    

<%= notice %>

加入:  

<%= alert %>

    <%= yield %>

 

指令:rails generate devise user

            rake db:migrate

            rails generate devise:views

将app/views/devise/registrations/new.html.erb

<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>

修改为:<%= form_for(resource, as: resource_name, url: registration_path(resource_name), data: {turbo: false}) do |f| %>

你可能感兴趣的:(Rails 7 gem devise)