Rails: Edit record in Bootstrap modal

前端 未结 2 587
我在风中等你
我在风中等你 2021-02-09 06:07

I\'m trying to use a Bootstrap modal in Rails to edit a record, but I can\'t get the modal to scope to the current record

The static link is

<%= lin         


        
2条回答
  •  失恋的感觉
    2021-02-09 06:31

    Another way to do it is like so:

    just create a remote link:

    link_to "edit", edit_ticket_path(ticket), class: "btn btn-mini", remote: true
    

    Then in your views, add a edit.js.erb file:

    $("#myModal").html("<%= j render 'new' %>");
    $('#myModal').modal('show');
    

    and change your new.html files to _new.html

提交回复
热议问题