<commit_before>try {
var action_link;
<%
  form_selector ||= "#{element_form_id(:action => :create)}"
  insert_at ||= :top 
  always_show_create ||= active_scaffold_config.actions.include?(:list) && active_scaffold_config.list.always_show_create
-%>
<% if always_show_create -%>
<%= render :partial => 'update_messages' %>
<% else -%>
action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
<% end -%>
<% if successful? -%>
  <% if render_parent? %>
    <% if nested_singular_association? %>
      action_link.close(true);
    <% elsif params[:parent_sti] && render_parent_action == :row %>
      ActiveScaffold.create_record_row_from_url(action_link,'<%= url_for(render_parent_options) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
    <% else %>
      ActiveScaffold.reload('<%= url_for render_parent_options %>');
    <% end %>
  <% elsif active_scaffold_config.create.refresh_list %>
    <%= render :partial => 'refresh_list' %>
  <% elsif params[:parent_controller].nil? %>
    <% new_row = render :partial => 'list_record', :locals => {:record => @saved_record || @record} %>
    ActiveScaffold.create_record_row(action_link ? action_link.scaffold() : '<%= active_scaffold_id %>', '<%= escape_javascript(new_row) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
    <%= render :partial => 'update_calculations', :formats => [:js] %>
  <% end %>

  <% unless render_parent? %>
    <% if always_show_create %>
      ActiveScaffold.reset_form('<%= form_selector %>');
    <% elsif params[:dont_close] %>
      ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render(:partial => 'create_form', :locals => {:xhr => true})) %>');
      ActiveScaffold.focus_first_element_of_form('<%= form_selector %>');
    <% else %>
      action_link.close();
    <% end %>
    <% if (active_scaffold_config.create.action_after_create) %>
      var link = ActiveScaffold.find_action_link('<%= action_link_id active_scaffold_config.create.action_after_create, @record.id || @saved_record.id %>');
      if (link) (function() { link.open() })<%= '.defer' if ActiveScaffold.js_framework == :prototype %>();
    <% end %>
  <% end %>
<% else %>
  ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render(:partial => 'create_form', :locals => {:xhr => true})) %>');
  ActiveScaffold.scroll_to('<%= form_selector %>', true);
<% end %>
} catch (e) { alert('RJS error:\n\n' + e.toString());}
<commit_msg>display row even after create even if action link is not found<commit_after>try {
var action_link;
<%
  form_selector ||= "#{element_form_id(:action => :create)}"
  insert_at ||= :top 
  always_show_create ||= active_scaffold_config.actions.include?(:list) && active_scaffold_config.list.always_show_create
-%>
<% if always_show_create -%>
<%= render :partial => 'update_messages' %>
<% else -%>
action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
if (action_link) action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
<% end -%>
<% if successful? -%>
  <% if render_parent? %>
    <% if nested_singular_association? %>
    if (action_link) action_link.close(true);
    <% elsif params[:parent_sti] && render_parent_action == :row %>
      ActiveScaffold.create_record_row_from_url(action_link,'<%= url_for(render_parent_options) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
    <% else %>
      ActiveScaffold.reload('<%= url_for render_parent_options %>');
    <% end %>
  <% elsif active_scaffold_config.create.refresh_list %>
    <%= render :partial => 'refresh_list' %>
  <% elsif params[:parent_controller].nil? %>
    <% new_row = render :partial => 'list_record', :locals => {:record => @saved_record || @record} %>
    ActiveScaffold.create_record_row(action_link ? action_link.scaffold() : '<%= active_scaffold_id %>', '<%= escape_javascript(new_row) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
    <%= render :partial => 'update_calculations', :formats => [:js] %>
  <% end %>

  <% unless render_parent? %>
    <% if always_show_create %>
      ActiveScaffold.reset_form('<%= form_selector %>');
    <% elsif params[:dont_close] %>
      ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render(:partial => 'create_form', :locals => {:xhr => true})) %>');
      ActiveScaffold.focus_first_element_of_form('<%= form_selector %>');
    <% else %>
      if (action_link) action_link.close();
    <% end %>
    <% if (active_scaffold_config.create.action_after_create) %>
      var link = ActiveScaffold.find_action_link('<%= action_link_id active_scaffold_config.create.action_after_create, @record.id || @saved_record.id %>');
      if (link) (function() { link.open() })<%= '.defer' if ActiveScaffold.js_framework == :prototype %>();
    <% end %>
  <% end %>
<% else %>
  ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render(:partial => 'create_form', :locals => {:xhr => true})) %>');
  ActiveScaffold.scroll_to('<%= form_selector %>', true);
<% end %>
} catch (e) { alert('RJS error:\n\n' + e.toString());}

{'fraction_non_alphanumeric': 0.1964628988850442, 'fraction_numerical': 0.0, 'mean_word_length': 5.150118203309693, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 125, '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': '5758781', 'n_tokens_mistral': 1880, 'n_tokens_neox': 1709, 'n_words': 271}