when i submit form submit doesn't go to reject_permission. error is URL something wrong like this
my view
<%= link_to 'Reject', '#', 'data-target' => "#editpermission",'data-toggle' => 'modal' ,
'data-id' => "#{permission.id}",class: "edit btn btn-danger btn-sm" %>
<%= render 'edit_permission_modal'%>
<script type="text/javascript">
$(document).on("click",".edit",function(){
var permissionId = $(this).data('id');
$(".modal-body #permissionId").attr("value",permissionId);
})
</script>
edit_permission_modal.html.erb
<div class="modal fade" id="editpermission" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
<%= form_for reject_path,multipart: true, method: :patch do |f| %>
<input type="hidden" name="id" id="permissionId" class="form-control" value="">
<%=f.text_field :rejected_reason,class: "form-control"%>
</div>
<div class="modal-footer">
<%= f.submit 'Reject', class: "btn btn-danger btn-sm" %>
</div>
<%end%>
</div>
</div>
</div>
controller
class PermissionsController < ApplicationController
before_action :set_permission, only: [:show, :edit, :update, :destroy,:accept_permission]
def reject_permission
puts "reject_permission"
end
end
routes
resources :permissions
patch 'permissions/reject_permission',to: 'permissions#reject_permission', as: :reject
Aucun commentaire:
Enregistrer un commentaire