<commit_before># wrap the action rendering for ActiveScaffold controllers
module ActionController #:nodoc:
  class Base
    def render_with_active_scaffold(*args, &block)
      if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil? and request.xhr?
        @rendering_adapter = true # recursion control
        # if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
        opts = args.blank? ? Hash.new : args.first
        unless opts[:js] || (opts[:formats] || lookup_context.formats).include?(:js)
          render :partial => params[:adapter][1..-1],
            :locals => {:payload => render_to_string(opts.merge(:layout => false), &block).html_safe},
            :use_full_path => true, :layout => false, :content_type => :html
          @rendering_adapter = nil # recursion control
        else
          render_without_active_scaffold(*args, &block)
        end
      else
        render_without_active_scaffold(*args, &block)
      end
    end
    alias_method_chain :render, :active_scaffold
  end
end
<commit_msg>fix last commit, it broke ajax actions<commit_after># wrap the action rendering for ActiveScaffold controllers
module ActionController #:nodoc:
  class Base
    def render_with_active_scaffold(*args, &block)
      if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil? and request.xhr?
        @rendering_adapter = true # recursion control
        # if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
        opts = args.blank? ? Hash.new : args.first
        unless opts[:js] || opts[:formats] == [:js] || opts[:partial].blank?
          render :partial => params[:adapter][1..-1],
            :locals => {:payload => render_to_string(opts.merge(:layout => false), &block).html_safe},
            :use_full_path => true, :layout => false, :content_type => :html
          @rendering_adapter = nil # recursion control
        else
          render_without_active_scaffold(*args, &block)
        end
      else
        render_without_active_scaffold(*args, &block)
      end
    end
    alias_method_chain :render, :active_scaffold
  end
end

{'fraction_non_alphanumeric': 0.10236924452391596, 'fraction_numerical': 0.001788109074653554, 'mean_word_length': 3.175373134328358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4938499', 'n_tokens_mistral': 647, 'n_tokens_neox': 637, 'n_words': 185}