美文网首页
Rails 7 gem devise

Rails 7 gem devise

作者: Zee_jin | 来源:发表于2022-09-14 14:42 被阅读0次

加入: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

<body>

加入:    <p class="notice"><%= notice %></p>

加入:   <p class="alert"><%= alert %></p>

    <%= yield %>

  </body>

指令: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

      本文链接:https://www.haomeiwen.com/subject/weakortx.html