Class Actual is managing the creation and deletion of objects in class Friendgroup. The form page

<ul id=friendgroups>   <%= render @friendgroups %> </ul>

<%= form_with model:, data: {'js-friendgroup-form' => true} do |form| %>   
  Name <%= form.text_field :name %>
  <%= form.submit %> 
<% end %>

calls the collection of friendgroups properly on page load, the controller for friendgroups does create records:

  def create
    params[:friendgroup][:user_id] =
    @friendgroup =
    authorize @friendgroup
      render partial: 'friendgroup', locals: {friendgroup: @friendgroup}

On page load, existing objects are loaded:

<li data-js-friendgroup-id=<%= %>>
  <%= %> <%= link_to "Delete", friendgroup, remote: true, method: :delete, data: { confirm: "Are you sure you want to delete '#{}'?" } %>

However, the AJAX actions are not percolating back to the index, leading me to conclude that the javascript functions are no binding to the proper classes/items:

//= require jquery3
//= require jquery-ui
//= require rails-ujs
$(document).ready(function() {
  $('[data-js-friendgroup-form]').on("ajax:success", function(event, data, status, xhr){
    var friendgroup = $(xhr.responseText).hide();
//    $('#friendgroups').append(xhr.responseText);

  $('[data-js-friendgroup-id]').on("ajax:success", function(event, data, status, xhr){
    var friendgroup_id =;
    $('[data-js-friendgroup-id=' + friendgroup_id + ']').hide();

Another possible culprit is the console error TypeError: url.indexOf is not a function being activated by jQuery3, but that has little to do with the above code.

How can these cross model actions run properly?

1 Answers

user2965549 On

bad eyes question


instead of