在我的Rails应用程序中,有一个名为“编辑配置文件”的按钮。当我单击显示引导模态的按钮时。我对此有一个问题。每个pach都会在日志中呈现编辑配置文件模板。 这是我的编辑个人资料按钮
<button type="button" class="btn btn-light" data-toggle="modal" data-target="#exampleModalLong" , onclick="do_save">
Edit Profile
</button>
<%= render template: "devise/registrations/edit" %>
这是我的edit.html.erb
<div class="modal fade" id="exampleModalLong" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}, remote: true) do |f| %>
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Edit <%= resource_name.to_s.humanize %></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div id='js-error-block'></div>
<div class="form-group">
<label for="user-email" class="col-form-label ">Email:</label>
<%= f.email_field :email, class: "form-control email", :readonly => true %>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="form-group">
<label for="password" class="col-form-label ">Password:</label>
<%= f.password_field :password, autocomplete: "new-password", class: "form-control password", required: true %>
<% if @minimum_password_length %>
<% end %>
</div>
<div class="form-group">
<label for="confirm-password" class="col-form-label">Confirm Password:</label>
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control confirm", required: true %>
</div>
<div class="form-group">
<label for="current-password" class="col-form-label">Current Password:</label>
<strong>(we need your current password to confirm your changes)</strong><br/>
<%= f.password_field :current_password, autocomplete: "current-password", class: "form-control current", required: true %>
</div>
<div class="actions">
<button type="button" class="btn btn-primary btn-sm">
<%= f.submit "Update", class: "btn btn-primary" %>
</button>
</div>
<% end %>
<div class="account-cancel">
<h3>Cancel my account</h3>
<p>Think Twice Before Do? </p>
<%= button_to "Cancel my account", registration_path(resource_name), class: "btn btn-danger", data: {confirm: "Are you sure?"}, method: :delete %>
</div>
</div>
</div>
</div>
</div>
这是我的日志
Started GET "/topics/1" for 127.0.0.1 at 2019-03-14 10:40:49 +0530
Processing by TopicsController#show as HTML
Parameters: {"id"=>"1"}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]]
↳ C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/bundler/gems/remotipart-2f304f157cc6/lib/remotipart/middleware.rb:32
Topic Load (0.5ms) SELECT "topics".* FROM "topics" WHERE "topics"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
↳ app/controllers/topics_controller.rb:72
Rendering topics/show.html.erb within layouts/application
Rendered topics/show.html.erb within layouts/application (1.9ms)
Rendering devise/registrations/edit.html.erb
Rendered devise/registrations/edit.html.erb (2.8ms)
Rendered shared/_navbar.html.erb (33.9ms)
Completed 200 OK in 463ms (Views: 400.0ms | ActiveRecord: 2.1ms)
如何避免按请求显示渲染编辑配置文件日志,并且当我单击“编辑配置文件”按钮时显示登录请求?