<commit_before>try {
<% form_selector ||= "#{element_form_id(:action => :update, :id => @record.try(:id) || params[:id])}" %>
var action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
<% if successful? %>
  <% if params[:dont_close] %>
    <% row_selector = element_row_id(:action => :list, :id => @record.id) %>
    ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
    action_link.target = $('#<%= row_selector %>');
    <%= render :partial => 'update_calculations', :formats => [:js] %>
    <% if params[:iframe] == 'true' %>
      ActiveScaffold.enable_form('<%= form_selector %>');
    <% end %>
  <% else %>
    <% if render_parent? %>
      <% if nested_singular_association? || render_parent_action == :row %>
        action_link.close(true);
      <% else %>
        ActiveScaffold.reload('<%= url_for render_parent_options %>');
      <% end %>
    <% elsif update_refresh_list? %>
      <%= render :partial => 'refresh_list' %>
    <% else %>
      <% if @record %>
      action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
      <% else %>
      action_link.close();
      ActiveScaffold.delete_record_row('<%= element_row_id(:action => :list, :id => params[:id]) %>');
      <% end %>
      <%= render :partial => 'update_calculations', :formats => [:js] %>
    <% end %>
  <% end %>
<% else %>
  ActiveScaffold.replace('<%= form_selector %>', '<%= escape_javascript(render(:partial => 'update_form', :locals => {:xhr => true})) %>');
  ActiveScaffold.scroll_to('<%= form_selector %>', true);
<% end %>
} catch (e) { alert('RJS error:\n\n' + e.toString());}<commit_msg>avoid failing JS after update if action_link is not found<commit_after>try {
<% form_selector ||= "#{element_form_id(:action => :update, :id => @record.try(:id) || params[:id])}" %>
var action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
if (action_link) action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
<% if successful? %>
  <% if params[:dont_close] %>
    <% row_selector = element_row_id(:action => :list, :id => @record.id) %>
    ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
    if (action_link) action_link.target = $('#<%= row_selector %>');
    <%= render :partial => 'update_calculations', :formats => [:js] %>
    <% if params[:iframe] == 'true' %>
      ActiveScaffold.enable_form('<%= form_selector %>');
    <% end %>
  <% else %>
    <% if render_parent? %>
      <% if nested_singular_association? || render_parent_action == :row %>
        if (action_link) action_link.close(true);
      <% else %>
        ActiveScaffold.reload('<%= url_for render_parent_options %>');
      <% end %>
    <% elsif update_refresh_list? %>
      <%= render :partial => 'refresh_list' %>
    <% else %>
      <% if @record %>
      if (action_link) action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
      <% else %>
      if (action_link) action_link.close();
      ActiveScaffold.delete_record_row('<%= element_row_id(:action => :list, :id => params[:id]) %>');
      <% end %>
      <%= render :partial => 'update_calculations', :formats => [:js] %>
    <% end %>
  <% end %>
<% else %>
  ActiveScaffold.replace('<%= form_selector %>', '<%= escape_javascript(render(:partial => 'update_form', :locals => {:xhr => true})) %>');
  ActiveScaffold.scroll_to('<%= form_selector %>', true);
<% end %>
} catch (e) { alert('RJS error:\n\n' + e.toString());}
{'fraction_non_alphanumeric': 0.22320730117340287, 'fraction_numerical': 0.0, 'mean_word_length': 4.3277777777777775, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '250206', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1212, 'n_words': 222}